File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Distributed Java and the fly likes Implementing Singleton in clustered environment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Implementing Singleton in clustered environment" Watch "Implementing Singleton in clustered environment" New topic
Author

Implementing Singleton in clustered environment

Sriram Sharma
Ranch Hand

Joined: Apr 12, 2006
Posts: 98
First of all, I am not sure if I am posting my query in the correct forum.
If I need to change to a different forum, please let me know and I shall do the same.

How do we implement a singleton design pattern in a clustered environment?
This was an interview question for which I did not have an answer.
I understand singleton design pattern and the double checked locking as well.
Could someone explain me how we could implement Singleton in a clustered environment?

Regards,
Sriraam
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

I don't think you can, (different JVMs means impossible to share same instance). And I think it would be a waste of time to try. Instead, you need to understand what requirement led to the 'need' for Singleton, then try to match that requirement rather than match the implementation. Read WhatNotHow as it pertains to this very nicely.


Steve
Devendra Katiyar
Greenhorn

Joined: Jun 23, 2014
Posts: 3

Check the below Link

http://www.techspot.co.in/2009/07/singleton-in-cluster.html
 
 
subject: Implementing Singleton in clustered environment