This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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: 125
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Implementing Singleton in clustered environment
It's not a secret anymore!