This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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 Building Microservices this week in the Design 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: 234
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: 2543

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
Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 234
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.
Have you checked out Aspose?
subject: Instance of Singleton pattern
It's not a secret anymore!