Class ClusterMonitor

    • Constructor Detail

      • ClusterMonitor

        public ClusterMonitor()
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: Module
        Returns the name of the module for display in administration interfaces.
        Specified by:
        getName in interface Module
        Returns:
        The name of the module.
      • initialize

        public void initialize​(XMPPServer xmppServer)
        Description copied from interface: Module
        Initialize the module with the container. Modules may be initialized and never started, so modules should be prepared for a call to destroy() to follow initialize().
        Specified by:
        initialize in interface Module
        Parameters:
        xmppServer - the server hosting this module.
      • start

        public void start()
        Description copied from interface: Module
        Start the module (must return quickly). Any long running operations should spawn a thread and allow the method to return immediately.
        Specified by:
        start in interface Module
      • stop

        public void stop()
        Description copied from interface: Module
        Stop the module. The module should attempt to free up threads and prepare for either another call to initialize (reconfigure the module) or for destruction.
        Specified by:
        stop in interface Module
      • destroy

        public void destroy()
        Description copied from interface: Module
        Module should free all resources and prepare for deallocation.
        Specified by:
        destroy in interface Module
      • joinedCluster

        public void joinedCluster()
        Description copied from interface: ClusterEventListener
        Notification event indicating that this JVM is now part of a cluster. At this point the XMPPServer.getNodeID() holds the new nodeID value.

        When joining the cluster as the senior cluster member the ClusterEventListener.markedAsSeniorClusterMember() event will be sent right after this event.

        At this point the CacheFactory holds clustered caches. That means that modifications to the caches will be reflected in the cluster. The clustered caches were just obtained from the cluster and no local cached data was automatically moved.

        It is generally advisable that implementations of this method:
        • enrich clustered cache data, by (re)adding data from this JVM/cluster node to relevant caches
        • invoke applicable event listeners, to reflect changes in availability of data on other cluster nodes.
        Specified by:
        joinedCluster in interface ClusterEventListener
      • joinedCluster

        public void joinedCluster​(byte[] nodeIdBytes)
        Description copied from interface: ClusterEventListener
        Notification event indicating that another JVM is now part of a cluster.

        At this point the CacheFactory of the new node holds clustered caches. That means that modifications to the caches of this JVM will be reflected in the cluster and in particular in the new node.

        Specified by:
        joinedCluster in interface ClusterEventListener
        Parameters:
        nodeIdBytes - ID of the node that joined the cluster.
      • leftCluster

        public void leftCluster()
        Description copied from interface: ClusterEventListener
        Notification event indicating that this JVM is no longer part of the cluster. This could happen when disabling clustering support, removing the enterprise plugin that provides clustering support or connection to cluster got lost.

        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.

        At this point the CacheFactory holds local caches. That means that modifications to the caches will only affect this JVM. It is generally advisable that implementations of this method:

        • restore relevant caches content, by repopulating the caches with data from this JVM/cluster node
        • invoke applicable event listeners, to reflect changes in availability of data on other cluster nodes.
        Specified by:
        leftCluster in interface ClusterEventListener
      • leftCluster

        public void leftCluster​(byte[] nodeIdBytes)
        Description copied from interface: ClusterEventListener
        Notification event indicating that another JVM is no longer part of the cluster. This could happen when disabling clustering support, removing the enterprise plugin that provides clustering support or connection to cluster got lost.

        Moreover, if we were in a "split brain" scenario (ie. separated cluster islands) and the island were the other 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 the other JVM was the senior cluster member and when the islands met again then the other JVM stopped being the senior member.

        At this point the CacheFactory of the leaving node holds local caches. That means that modifications to the caches of this JVM will not affect the leaving node but other cluster members. It is generally advisable that implementations of this method invoke applicable event listeners, to reflect changes in availability of data (related to the node that left). Often, this action is orchestrated by only one of the remaining cluster nodes: the senior member.

        Specified by:
        leftCluster in interface ClusterEventListener
        Parameters:
        nodeIdBytes - ID of the node that is left the cluster.
      • markedAsSeniorClusterMember

        public void markedAsSeniorClusterMember()
        Description copied from interface: ClusterEventListener
        Notification 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 ClusterEventListener.leftCluster() and ClusterEventListener.joinedCluster() events.

        Specified by:
        markedAsSeniorClusterMember in interface ClusterEventListener