users@glassfish.java.net

Re: Singleton vs. J2EE spec, how to implement a data cache

From: <glassfish_at_javadesktop.org>
Date: Mon, 26 Jan 2009 10:55:06 PST

We have static map in some beans and never experienced any problem from pooling point of view. Static field belongs to the class, not to the object, so the beans can be created/destroyed by the app. server. What you maybe need to take care of is classloaders, for instance you can not create a custom MBean to administer you cache, because MBean are in a different classloader. But for a simple cache within a bean I think it's ok, even if it is not recommended by the EJB specs.
[Message sent by forum member 'ewernli' (ewernli)]

http://forums.java.net/jive/thread.jspa?messageID=328237