Java / Design Patterns
How do we ensure Singleton Design Pattern in a clustered Environment?
Each JVM will have its own copy of singleton object in clustered environment, so we may have to use different techniques to ensure only one instance exists across multiple JVMs in clustered environment.
Terracotta, Oracle Coherence provides an in memory replication of objects across JVMs that enables singleton view.
Cluster-aware cache providers like Swarm Cache or JBoss TreeCache create cache entries as singletons.
JBoss and Weblogic has the concept of Singleton Service where only instance runs within the cluster and all clients will look up to the same instance. WebSphere application server also supports the concept of singleton across clusters.
JMS, JGroups software allows to form a group and Applications (JVMs) can participate and JGroups will send messages to everyone in the group so that they can be in sync.
More Related questions...