jQuery in Action, 2nd edition*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Singleton Pattern in distributed System Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Singleton Pattern in distributed System" Watch "Singleton Pattern in distributed System" New topic
Author

Singleton Pattern in distributed System

Abdul Kader
Ranch Hand

Joined: Apr 11, 2007
Posts: 115
I like to know how we can make sure a class must have only one object in a distributed System. (I.e. how can we apply singleton patterns which two or more JVM)
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
This can be difficult and can probably best be done by some proprietary application server feature. For instance, the app server may be able to pin the singleton to a specific server instance in the cluster.

A better question would be: What are you trying to achieve?


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Srilakshmi Vara
Ranch Hand

Joined: Jul 21, 2004
Posts: 169
Implementing Singleton Pattern in distributed environment has the following issues to address.

1. Ensures Single object per JVM. If you have multiple JVMs need to address it programmatically.
2. Implement Doouble checked locking in your program.
Uday Patel
Greenhorn

Joined: Apr 07, 2008
Posts: 3
Why am I not surprised that Singleton has been identified as Anti-pattern.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Singleton Pattern in distributed System