File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes using singleton pattern in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "using singleton pattern in java " Watch "using singleton pattern in java " New topic

using singleton pattern in java

Anand Jain

Joined: Jul 27, 2009
Posts: 18
Can you give me the scenarios where Singleton pattern is used in Java?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

you may need some values [which are common for the application ] from database on application startup time
Suhas Bilaye
Ranch Hand

Joined: Sep 10, 2009
Posts: 80
When huge objects like Hibernate Session Factory is to be created only once and the same object is to be used throughout the application

Thanks and Regards,
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46360
Have a look at this thread and the links in it.
I agree. Here's the link:
subject: using singleton pattern in java
jQuery in Action, 3rd edition