Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.7.1 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jivesoftware.openfire.cluster
Class ClusterManager

    java.lang.Object
      org.jivesoftware.openfire.cluster.ClusterManager

    public class ClusterManager

extends Object

A cluster manager is responsible for triggering events related to clustering. A future version will also provide statistics about the cluster.

Author:
  Gaston Dombiak

Field Summary
`static String` | `CLUSTER_PROPERTY_NAME`

Constructor Summary
`ClusterManager()`

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### CLUSTER_PROPERTY_NAME

    public static String CLUSTER_PROPERTY_NAME

Constructor Detail

### ClusterManager

    public ClusterManager()

Method Detail

### addListener

    public static void addListener(ClusterEventListener listener)

  Registers a listener to receive events.

  Parameters:
    `listener` - the listener.

### removeListener

    public static void removeListener(ClusterEventListener listener)

  Unregisters a listener to receive events.

  Parameters:
    `listener` - the listener.

### fireJoinedCluster

    public static void fireJoinedCluster(boolean asynchronous)

  Triggers event indicating that this JVM is now part of a cluster. At this point the `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.

  This event will be triggered in another thread. This will avoid potential deadlocks in Coherence.

  Parameters:
    `asynchronous` - true if event will be triggered in background

### fireJoinedCluster

    public static void fireJoinedCluster(byte[] nodeID,
                                         boolean asynchronous)

  Triggers event indicating that another JVM is now part of a cluster.

  This event will be triggered in another thread. This will avoid potential deadlocks in Coherence.

  Parameters:
    `nodeID` - nodeID assigned to the JVM when joining the cluster.
    `asynchronous` - true if event will be triggered in background

### fireLeftCluster

    public static void fireLeftCluster()

  Triggers event indicating that this JVM is no longer part of the cluster. This could happen when disabling clustering support or removing the enterprise plugin that provides clustering support.

  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.

### fireLeftCluster

    public static void fireLeftCluster(byte[] nodeID)

  Triggers event indicating that another JVM is no longer part of the cluster. This could happen when disabling clustering support or removing the enterprise plugin that provides clustering support.

  Parameters:
    `nodeID` - nodeID assigned to the JVM when joining the cluster.

### fireMarkedAsSeniorClusterMember

    public static void fireMarkedAsSeniorClusterMember()

  Triggers event indicating that this JVM is now the senior cluster member. This could either happen when initially joining the cluster or when the senior cluster member node left the cluster and this JVM was marked as the new senior cluster member.

  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.

### startup

    public static void startup()

  Starts the cluster service if clustering is enabled. The process of starting clustering will recreate caches as distributed caches.

  Before starting a cluster the `XMPPServer.setRemoteSessionLocator(org.jivesoftware.openfire.session.RemoteSessionLocator)` and `RoutingTable.setRemotePacketRouter(org.jivesoftware.openfire.RemotePacketRouter)` need to be properly configured.

### shutdown

    public static void shutdown()

  Shuts down the clustering service. This method should be called when the Jive system is shutting down, and must not be called otherwise. Failing to call this method may temporarily impact cluster performance, as the system will have to do extra work to recover from a non-clean shutdown. If clustering is not enabled, this method will do nothing.

### setClusteringEnabled

    public static void setClusteringEnabled(boolean enabled)

  Sets true if clustering support is enabled. An attempt to start or join an existing cluster will be attempted in the service was enabled. On the other hand, if disabled then this JVM will leave or stop the cluster.

  Parameters:
    `enabled` - if clustering support is enabled.

### isClusteringEnabled

    public static boolean isClusteringEnabled()

  Returns true if clustering support is enabled. This does not mean that clustering has started or that clustering will be able to start.

  Returns:
    true if clustering support is enabled.

### isClusteringAvailable

    public static boolean isClusteringAvailable()

  Returns true if clustering is installed and can be used by this JVM to join a cluster. A false value could mean that either clustering support is not available or the license does not allow to have more than 1 cluster node.

  Returns:
    true if clustering is installed and can be used by this JVM to join a cluster.

### isClusteringStarting

    public static boolean isClusteringStarting()

  Returns true is clustering is currently being started. Once the cluster is started or failed to be started this value will be false.

  Returns:
    true is clustering is currently being started.

### isClusteringStarted

    public static boolean isClusteringStarted()

  Returns true if this JVM is part of a cluster. The cluster may have many nodes or this JVM could be the only node.

  Returns:
    true if this JVM is part of a cluster.

### isSeniorClusterMember

    public static boolean isSeniorClusterMember()

  Returns true if this member is the senior member in the cluster. If clustering is not enabled, this method will also return true. This test is useful for tasks that should only be run on a single member in a cluster.

  Returns:
    true if this cluster member is the senior or if clustering is not enabled.

### getNodesInfo

    public static Collection<ClusterNodeInfo> getNodesInfo()

  Returns basic information about the current members of the cluster or an empty collection if not running in a cluster.

  Returns:
    information about the current members of the cluster or an empty collection if not running in a cluster.

### getMaxClusterNodes

    public static int getMaxClusterNodes()

  Returns the maximum number of cluster members allowed. Both values 0 and 1 mean that clustering is not available. However, a value of 1 means that it's a license problem rather than not having the ability to do clustering as defined with value 0.

  Returns:
    the maximum number of cluster members allowed or 0 or 1 if clustering is not allowed.

### getSeniorClusterMember

    public static NodeID getSeniorClusterMember()

  Returns the id of the node that is the senior cluster member. When not in a cluster the returned node id will be the `XMPPServer.getNodeID()`.

  Returns:
    the id of the node that is the senior cluster member.

### isClusterMember

    public static boolean isClusterMember(byte[] nodeID)

  Returns true if the specified node ID belongs to a known cluster node of this cluster.

  Parameters:
    `nodeID` - the ID of the node to verify.
  Returns:
    true if the specified node ID belongs to a known cluster node of this cluster.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.7.1 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Jive Software.