File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Instance of Singleton pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Instance of Singleton pattern" Watch "Instance of Singleton pattern" New topic

Instance of Singleton pattern

Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 227
Hi All,

If I have a distributed architecture with load balancing and clustering feature and I have used Singleton patterns then how many object of that Singleton class will be across this application with multiple servers.

Thanks in Advance,
Jan Cumps

Joined: Dec 20, 2006
Posts: 2476

How did you implement the Singleton?
It can be one per class loader, one per jvm, one per server, or more

Have a read at this article:

OCUP UML fundamental and ITIL foundation
youtube channel
Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 227
Suppose below is my code for Singleton class. Then what will happen?

Muhammad Khojaye
Ranch Hand

Joined: Apr 12, 2009
Posts: 449

As already been told above, each JVM will have its own Singleton instance.
I agree. Here's the link:
subject: Instance of Singleton pattern
Similar Threads
Singleton in SWING
Singleton Factory Object
Doubt with a singleton class
Singleton Question
Generic Singleton Class