File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Singleton Pattern in Cluster 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 » Java » EJB and other Java EE Technologies
Bookmark "Singleton Pattern in Cluster" Watch "Singleton Pattern in Cluster" New topic
Author

Singleton Pattern in Cluster

Abhishek Arya
Greenhorn

Joined: Mar 22, 2004
Posts: 2
Hi,
Can any body tell me the behaviour of Singleton Class in a Clustered Environment.
Let us suppose there are thee servers in a cluster, then whether the Singleton Class will be instanciated in each of the Cluster??
Regards,
eammon bannon
Ranch Hand

Joined: Mar 16, 2004
Posts: 140
Yes. The rule for a singleton is that it guarentees one intance per JVM. There are patterns out there which can make sure there is only one instance of a singleton in a cluster, but for most normal cases where you would use a singleton (i.e. a small amount of read-only data needs cached for your app) having an instance per JVM is not really a problem. If you have an occasion where you must have only one instance per clustered application, you can do this with RMI - deploying the singlton as a RMI service, and looking it up through JNDI.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Singleton Pattern in Cluster
 
Similar Threads
Singleton class in cluster
How to replicate Singleton Data to all servers in Cluster
Clustering approach.
Weblogic cluster question
What is the behaviour of Singleton class in weblogic server Cluster Environment