Using a Cache Singleton implementation from an EJB
This is a general question that I have about the use of a singleton class from an EJBs.
I want to create a cache in the form of a singleton (suppose for now, no server clustering). The goal of this cache would be to speed access to a database. Different users logging into the system would access this single data point to get cached db info relevant to their privilages instead of resorting to database calls all the time. Suppose I want to use stateless session EJBs.
How do I make sure that after a creation of a Singleton in the VM, it doesn't go away when a particular ejb object gets' destroyed by the container? How does the lifecycle of the EJB relate to that of this cache? Given that the VMs garbage collector does not scrap my cache unless I have a reference to it, how do I maintain such a reference across multiple stateless session beans?
Any light on this issue would be really appreciated!
Thanks,
Alex

