how to cache a pre-compiled query?
I am trying to use QueryProcessor to compile and cache for later, in case no used modules have changed, is this ok? Can I concurrently use QueryProcessor within the same JVM in different threads? Thanks. -- Maurício Santiago de Castro mauricioscastro@hotmail.com <mailto:mauricioscastro@hotmail.com><http://br.linkedin.com/pub/mauricio-castro/17/275/a5b><http://www.delicious.com/mscastro><http://twitter.com/#%21/mauricioscastro>mauriciosantiagodecastro@facebook <http://facebook.com/mauriciosantiagodecastro><https://mscastro.startssl.com/>
Hi Maurice, Am 06.06.2012 um 14:30 schrieb Mauricio S. Castro:
I am trying to use QueryProcessor to compile and cache for later, in case no used modules have changed, is this ok? I suppose this will not work, unfortunatedly: the query processor contains some (dynamically evaluated like databases to access) yet stateful information that makes it impossible to cache.
Can I concurrently use QueryProcessor within the same JVM in different threads? For those very reasons I'd suggest you to use ThreadLocals [1] and a dedicated processor per Thread; that way you are definitely on the safe side.
Creating an instance of QueryProcessor should be a rather lightweight operation, as such I hope this suits your needs. I hope this helped, feel free to ask for more! Kind regards Michael [1] http://docs.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html
participants (2)
-
Mauricio S. Castro -
Michael Seiferle