This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
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

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
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: 40502
Have a look at this thread and the links in it.
I agree. Here's the link:
subject: using singleton pattern in java