public class ClusterManager extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CLUSTER_PROPERTY_NAME |
Constructor and Description |
---|
ClusterManager() |
Modifier and Type | Method and Description |
---|---|
static void |
addListener(ClusterEventListener listener)
Registers a listener to receive events.
|
static void |
fireJoinedCluster(boolean asynchronous)
Triggers event indicating that this JVM is now part of a cluster.
|
static void |
fireJoinedCluster(byte[] nodeID,
boolean asynchronous)
Triggers event indicating that another JVM is now part of a cluster.
|
static void |
fireLeftCluster()
Triggers event indicating that this JVM is no longer part of the cluster.
|
static void |
fireLeftCluster(byte[] nodeID)
Triggers event indicating that another JVM is no longer part of the cluster.
|
static void |
fireMarkedAsSeniorClusterMember()
Triggers event indicating that this JVM is now the senior cluster member.
|
static int |
getMaxClusterNodes()
Returns the maximum number of cluster members allowed.
|
static Collection<ClusterNodeInfo> |
getNodesInfo()
Returns basic information about the current members of the cluster or an empty
collection if not running in a cluster.
|
static NodeID |
getSeniorClusterMember()
Returns the id of the node that is the senior cluster member.
|
static boolean |
isClusteringAvailable()
Returns true if clustering is installed and can be used by this JVM
to join a cluster.
|
static boolean |
isClusteringEnabled()
Returns true if clustering support is enabled.
|
static boolean |
isClusteringStarted()
Returns true if this JVM is part of a cluster.
|
static boolean |
isClusteringStarting()
Returns true is clustering is currently being started.
|
static boolean |
isClusterMember(byte[] nodeID)
Returns true if the specified node ID belongs to a known cluster node
of this cluster.
|
static boolean |
isSeniorClusterMember()
Returns true if this member is the senior member in the cluster.
|
static void |
removeListener(ClusterEventListener listener)
Unregisters a listener to receive events.
|
static void |
setClusteringEnabled(boolean enabled)
Sets true if clustering support is enabled.
|
static void |
shutdown()
Shuts down the clustering service.
|
static void |
startup()
Starts the cluster service if clustering is enabled.
|
public static String CLUSTER_PROPERTY_NAME
public static void addListener(ClusterEventListener listener)
listener
- the listener.public static void removeListener(ClusterEventListener listener)
listener
- the listener.public static void fireJoinedCluster(boolean asynchronous)
XMPPServer.getNodeID()
holds the new nodeID value and
the old nodeID value is passed in case the listener needs it.
When joining the cluster as the senior cluster member the fireMarkedAsSeniorClusterMember()
event will be sent right after this event.
asynchronous
- true if event will be triggered in backgroundpublic static void fireJoinedCluster(byte[] nodeID, boolean asynchronous)
This event will be triggered in another thread. This will avoid potential deadlocks in Coherence.
nodeID
- nodeID assigned to the JVM when joining the cluster.asynchronous
- true if event will be triggered in backgroundpublic static void fireLeftCluster()
Moreover, if we were in a "split brain" scenario (ie. separated cluster islands) and the island were this JVM belonged was marked as "old" then all nodes of that island will get the left cluster event and joined cluster events. That means that caches will be reset and thus will need to be repopulated again with fresh data from this JVM. This also includes the case where this JVM was the senior cluster member and when the islands met again then this JVM stopped being the senior member.
public static void fireLeftCluster(byte[] nodeID)
nodeID
- nodeID assigned to the JVM when joining the cluster.public static void fireMarkedAsSeniorClusterMember()
Moreover, in the case of a "split brain" scenario (ie. separated cluster islands) each
island will have its own senior cluster member. However, when the islands meet again there
could only be one senior cluster member so one of the senior cluster members will stop playing
that role. When that happens the JVM no longer playing that role will receive the
fireLeftCluster()
and fireJoinedCluster(boolean)
events.
This event will be triggered in another thread. This will avoid potential deadlocks in Coherence.
public static void startup()
public static void shutdown()
public static void setClusteringEnabled(boolean enabled)
enabled
- if clustering support is enabled.public static boolean isClusteringEnabled()
public static boolean isClusteringAvailable()
public static boolean isClusteringStarting()
public static boolean isClusteringStarted()
public static boolean isSeniorClusterMember()
public static Collection<ClusterNodeInfo> getNodesInfo()
public static int getMaxClusterNodes()
public static NodeID getSeniorClusterMember()
XMPPServer.getNodeID()
.public static boolean isClusterMember(byte[] nodeID)
nodeID
- the ID of the node to verify.Copyright © 2003-2008 Jive Software.