com.sun.enterprise.mgmt
Class ClusterManager

java.lang.Object
  extended by com.sun.enterprise.mgmt.ClusterManager
All Implemented Interfaces:
MessageListener, EventListener

public class ClusterManager
extends 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 Summary
ClusterManager(String groupName, String instanceName, Map<String,String> identityMap, Map props, List<ClusterViewEventListener> viewListeners, List<ClusterMessageListener> messageListeners)
          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.
 
Method Summary
 void addClusteMessageListener(ClusterMessageListener listener)
           
 ClusterViewManager getClusterViewManager()
          Returns the ClusterViewManager object.
 String getGroupName()
           
 HealthMonitor getHealthMonitor()
          Returns the HealthMonitor instance.
 PeerID getID(String name)
          Returns name encoded ID
 String getInstanceName()
          Gets the instance name
 com.sun.enterprise.mgmt.MasterNode getMasterNode()
          Returns the MasterNode instance
 NetworkManager getNetworkManager()
           
 NetworkManager getNetworkManager(String transport)
          Returns the NetworkManager instance
 String getNodeState(PeerID peerID, long threshold, long timeout)
           
 PeerID getPeerID()
           
 SystemAdvertisement getSystemAdvertisement()
          Gets the systemAdvertisement attribute of the JXTAPlatform object
 SystemAdvertisement getSystemAdvertisementForMember(PeerID id)
           
 int getType()
          Returns the message type which Message is supporting i.g.
 void groupStartup(GMSConstants.groupStartupState startupState, List<String> memberTokens)
           
 boolean isDiscoveryInProgress()
           
 boolean isGroupStartup()
           
 boolean isMaster()
           
 boolean isWatchdog()
           
 void notifyNewMaster()
           
 void receiveMessageEvent(MessageEvent event)
          Processing a MessageEvent
 void removeClusterViewEventListener(ClusterMessageListener listener)
           
 void reportJoinedAndReadyState()
           
 boolean send(PeerID peerid, Serializable msg)
           
 boolean send(PeerID peerid, Serializable msg, boolean validatePeeridInView)
          Send a message to a specific node or the group.
 void setClusterStopping()
           
 void start()
          Starts the ClusterManager and all it's services
 void stop(boolean isClusterShutdown)
          Stops the ClusterManager and all it's services
 void takeOverMasterRole()
           
 void waitFor(long msec)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClusterManager

public ClusterManager(String groupName,
                      String instanceName,
                      Map<String,String> identityMap,
                      Map props,
                      List<ClusterViewEventListener> viewListeners,
                      List<ClusterMessageListener> messageListeners)
               throws 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:
GMSException
Method Detail

isWatchdog

public boolean isWatchdog()

addClusteMessageListener

public void addClusteMessageListener(ClusterMessageListener listener)

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(String transport)
Returns the NetworkManager instance

Returns:
The networkManager value

getNetworkManager

public NetworkManager getNetworkManager()

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 String getInstanceName()
Gets the instance name

Returns:
The instance name

isMaster

public boolean isMaster()

send

public boolean send(PeerID peerid,
                    Serializable msg,
                    boolean validatePeeridInView)
             throws IOException,
                    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
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:
IOException - if an io error occurs
MemberNotInViewException

send

public boolean send(PeerID peerid,
                    Serializable msg)
             throws IOException,
                    MemberNotInViewException
Throws:
IOException
MemberNotInViewException

receiveMessageEvent

public void receiveMessageEvent(MessageEvent event)
                         throws MessageIOException
Processing a MessageEvent

Specified by:
receiveMessageEvent in interface MessageListener
Parameters:
event - a received message event
Throws:
MessageIOException - if I/O error occurs

getType

public int getType()
Description copied from interface: MessageListener
Returns the message type which Message is supporting i.g. Message.TYPE_CLUSTER_MANAGER_MESSAGE or Message.TYPE_HEALTH_MONITOR_MESSAGE's integer value or etc...

Specified by:
getType in interface MessageListener
Returns:
the message type about which this listener is concerned

getSystemAdvertisementForMember

public SystemAdvertisement getSystemAdvertisementForMember(PeerID id)

getSystemAdvertisement

public SystemAdvertisement getSystemAdvertisement()
Gets the systemAdvertisement attribute of the JXTAPlatform object

Returns:
The systemAdvertisement value

getNodeState

public String getNodeState(PeerID peerID,
                           long threshold,
                           long timeout)

getID

public PeerID getID(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(GMSConstants.groupStartupState startupState,
                         List<String> memberTokens)

isGroupStartup

public boolean isGroupStartup()

getGroupName

public String getGroupName()

isDiscoveryInProgress

public boolean isDiscoveryInProgress()


Copyright © 2012. All Rights Reserved.