Singleton
I went ahead and made the EntityManagerFactory for the LazyWriter a singleton. This caused me to pull the LazyWriter out of the CacheManagerBean and into a top-level class. That is probably a good move, anyway. Now, the hassle of loading the properties only needs to happen once per run of the server.
1 Comments:
While that should work for this case, you should be very reluctant to use a singleton in a container environment. By allowing only one instance of the class per VM you run the potential for introducing state problems in a clustered environment and potential preformance issues when considering resource pooling and transaction management.
Might an MBean make more sense for this sort of resource?
Post a Comment
<< Home