This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Caching in factory.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Caching in factory...." Watch "Caching in factory...." New topic
Author

Caching in factory....

Gaurav Jain
Ranch Hand

Joined: Mar 11, 2004
Posts: 108
Is it a good practise to cache the object which is created using a factory?
For example i create a Customer DAO using the DAO factory then after creating it i store it in a hashmap in the factory and then when a different request comes instead of creating the CustomerDAO again i serve the same from the hashmap.
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
It is an attractive option as long as your cached object is designed thread safe or multithreading is not an issue in your application.


I think, therefore I exist -- Rene Descartes
 
 
subject: Caching in factory....