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
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: 237
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: 2565

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: 237
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
It's not a secret anymore!