This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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 Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Caching in factory...." Watch "Caching in factory...." New topic

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
I agree. Here's the link:
subject: Caching in factory....
It's not a secret anymore!