File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Implementing Singleton in clustered environment

Sriram Sharma
Ranch Hand

Joined: Apr 12, 2006
Posts: 130
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?

Steve Luke

Joined: Jan 28, 2003
Posts: 4181

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.

Devendra Katiyar

Joined: Jun 23, 2014
Posts: 3

Check the below Link
I agree. Here's the link:
subject: Implementing Singleton in clustered environment
jQuery in Action, 3rd edition