public class ClusterManager extends Object implements MessageListener
| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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(com.sun.enterprise.ee.cms.core.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) |
public ClusterManager(String groupName, String instanceName, Map<String,String> identityMap, Map props, List<ClusterViewEventListener> viewListeners, List<ClusterMessageListener> messageListeners) throws com.sun.enterprise.ee.cms.core.GMSException
groupName - Name of Group to which this process/peer seeks
membershipinstanceName - A token identifying this instance/processidentityMap - 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 identityprops - 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 asynchronouslyviewListeners - listeners interested in group view change eventsmessageListeners - listeners interested in receiving messages.com.sun.enterprise.ee.cms.core.GMSException - Generic exception for handling errorspublic boolean isWatchdog()
public void addClusteMessageListener(ClusterMessageListener listener)
public void removeClusterViewEventListener(ClusterMessageListener listener)
public void stop(boolean isClusterShutdown)
isClusterShutdown - true if this peer is shutting down as part of cluster wide shutdownpublic void start()
public NetworkManager getNetworkManager(String transport)
transport - The type of transportpublic NetworkManager getNetworkManager()
public com.sun.enterprise.mgmt.MasterNode getMasterNode()
public HealthMonitor getHealthMonitor()
public ClusterViewManager getClusterViewManager()
public PeerID getPeerID()
public String getInstanceName()
public boolean isMaster()
public boolean send(PeerID peerid, Serializable msg, boolean validatePeeridInView) throws IOException, com.sun.enterprise.ee.cms.core.MemberNotInViewException
peerid - the node IDmsg - the message to sendvalidatePeeridInView - the flag to validate the peer idtrue 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.IOException - if an io error occurscom.sun.enterprise.ee.cms.core.MemberNotInViewException - if the peer id is not in viewpublic boolean send(PeerID peerid, Serializable msg) throws IOException, com.sun.enterprise.ee.cms.core.MemberNotInViewException
IOExceptioncom.sun.enterprise.ee.cms.core.MemberNotInViewExceptionpublic void receiveMessageEvent(MessageEvent event) throws MessageIOException
MessageEventreceiveMessageEvent in interface MessageListenerevent - a received message eventMessageIOException - if I/O error occurspublic int getType()
MessageListenerMessage is supporting
i.g. Message.TYPE_CLUSTER_MANAGER_MESSAGE or Message.TYPE_HEALTH_MONITOR_MESSAGE's integer value or etc...getType in interface MessageListenerpublic SystemAdvertisement getSystemAdvertisementForMember(PeerID id)
public SystemAdvertisement getSystemAdvertisement()
public PeerID getID(String name)
name - to name to encodepublic void takeOverMasterRole()
public void setClusterStopping()
public void waitFor(long msec)
public void notifyNewMaster()
public void reportJoinedAndReadyState()
public void groupStartup(com.sun.enterprise.ee.cms.core.GMSConstants.groupStartupState startupState,
List<String> memberTokens)
public boolean isGroupStartup()
public String getGroupName()
public boolean isDiscoveryInProgress()
Copyright © 2017–2019 Eclipse Foundation. All rights reserved.