From: <php...@li...> - 2006-07-24 16:26:50
|
Hi Paul, > to keep certain Java objects (in my > case Lucene index searchers, query filters) > persistent between client calls. I usually use a factory class: public class FooFactory { private static final Object foo=createFoo(); public Object getFoo() { return foo; } } This works because the JVM keeps the class Name=>Class bindings in a weak hash map and classes usually aren't gc'ed unless the VM runs short of memory. The above method can't be used if all nodes of a (weblogoc- or tomcat-) cluster should refer to the same foo instance or if there's no persistent VM at all(for example if lucene and the bridge classes have been compiled to native code and are started for each request). > I also suspect > serializing (sometimes > larger) objects is beyond the scope of session > variable too. Depends on how long you want to keep the data and how expensive it is to create. If the data is really expensive I would use the JPersistenceAdapter, serialize the data and store it on the master node, on the web server or in a database and deserialize it when the next request comes in. Regards, Jost Boekemeier ___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de |