File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Caching in factory....