Class ClusterManager

  • All Implemented Interfaces:
    MessageListener, java.util.EventListener

    public class ClusterManager
    extends java.lang.Object
    implements MessageListener
    The ClusterManager is the entry point for using the cluster management module which provides group communications and membership semantics on top of JXTA, Grizzly and others.
    • Constructor Detail

      • ClusterManager

        public ClusterManager​(java.lang.String groupName,
                              java.lang.String instanceName,
                              java.util.Map<java.lang.String,​java.lang.String> identityMap,
                              java.util.Map props,
                              java.util.List<ClusterViewEventListener> viewListeners,
                              java.util.List<ClusterMessageListener> messageListeners)
                       throws com.sun.enterprise.ee.cms.core.GMSException
        The ClusterManager is created using the instanceName, and a Properties object that contains a set of parameters that the employing application would like to set for its purposes, namely, configuration parameters such as failure detection timeout, retries, address and port on which to communicate with the group, group and instance IDs,etc. The set of allowed constants to be used as keys in the Properties object are specified in JxtaConfigConstants enum.
        Parameters:
        groupName - Name of Group to which this process/peer seeks membership
        instanceName - A token identifying this instance/process
        identityMap - Additional identity tokens can be specified through this Map object. These become a part of the SystemAdvertisement allowing the peer/system to be identified by the application layer based on their own notion of identity
        props - a Properties object containing parameters that are allowed to be specified by employing application //TODO: specify that INFRA IDs and address/port are composite keys in essence but addresses/ports could be shared across ids with a performance penalty. //TODO: provide an API to send messages, synchronously or asynchronously
        viewListeners - listeners interested in group view change events
        messageListeners - listeners interested in receiving messages.
        Throws:
        com.sun.enterprise.ee.cms.core.GMSException - Generic exception for handling errors
    • Method Detail

      • isWatchdog

        public boolean isWatchdog()
      • removeClusterViewEventListener

        public void removeClusterViewEventListener​(ClusterMessageListener listener)
      • stop

        public void stop​(boolean isClusterShutdown)
        Stops the ClusterManager and all it's services
        Parameters:
        isClusterShutdown - true if this peer is shutting down as part of cluster wide shutdown
      • start

        public void start()
        Starts the ClusterManager and all it's services
      • getNetworkManager

        public NetworkManager getNetworkManager​(java.lang.String transport)
        Returns the NetworkManager instance
        Parameters:
        transport - The type of transport
        Returns:
        The networkManager value
      • getMasterNode

        public com.sun.enterprise.mgmt.MasterNode getMasterNode()
        Returns the MasterNode instance
        Returns:
        The masterNode value
      • getHealthMonitor

        public HealthMonitor getHealthMonitor()
        Returns the HealthMonitor instance.
        Returns:
        The healthMonitor value
      • getClusterViewManager

        public ClusterViewManager getClusterViewManager()
        Returns the ClusterViewManager object. All modules use this common object which represents a synchronized view of a set of AppServers
        Returns:
        The clusterViewManager object
      • getPeerID

        public PeerID getPeerID()
      • getInstanceName

        public java.lang.String getInstanceName()
        Gets the instance name
        Returns:
        The instance name
      • isMaster

        public boolean isMaster()
      • send

        public boolean send​(PeerID peerid,
                            java.io.Serializable msg,
                            boolean validatePeeridInView)
                     throws java.io.IOException,
                            com.sun.enterprise.ee.cms.core.MemberNotInViewException
        Send a message to a specific node or the group. In the case where the id is null the message is sent to the entire group
        Parameters:
        peerid - the node ID
        msg - the message to send
        validatePeeridInView - the flag to validate the peer id
        Returns:
        boolean true if the message has been sent otherwise false. false. is commonly returned for non-error related congestion, meaning that you should be able to send the message after waiting some amount of time.
        Throws:
        java.io.IOException - if an io error occurs
        com.sun.enterprise.ee.cms.core.MemberNotInViewException - if the peer id is not in view
      • send

        public boolean send​(PeerID peerid,
                            java.io.Serializable msg)
                     throws java.io.IOException,
                            com.sun.enterprise.ee.cms.core.MemberNotInViewException
        Throws:
        java.io.IOException
        com.sun.enterprise.ee.cms.core.MemberNotInViewException
      • getSystemAdvertisement

        public SystemAdvertisement getSystemAdvertisement()
        Gets the systemAdvertisement attribute of the JXTAPlatform object
        Returns:
        The systemAdvertisement value
      • getNodeState

        public java.lang.String getNodeState​(PeerID peerID,
                                             long threshold,
                                             long timeout)
      • getID

        public PeerID getID​(java.lang.String name)
        Returns name encoded ID
        Parameters:
        name - to name to encode
        Returns:
        name encoded ID
      • takeOverMasterRole

        public void takeOverMasterRole()
      • setClusterStopping

        public void setClusterStopping()
      • waitFor

        public void waitFor​(long msec)
      • notifyNewMaster

        public void notifyNewMaster()
      • reportJoinedAndReadyState

        public void reportJoinedAndReadyState()
      • groupStartup

        public void groupStartup​(com.sun.enterprise.ee.cms.core.GMSConstants.groupStartupState startupState,
                                 java.util.List<java.lang.String> memberTokens)
      • isGroupStartup

        public boolean isGroupStartup()
      • getGroupName

        public java.lang.String getGroupName()
      • isDiscoveryInProgress

        public boolean isDiscoveryInProgress()