Package com.sun.enterprise.mgmt
Class HealthMonitor
- java.lang.Object
-
- com.sun.enterprise.mgmt.HealthMonitor
-
- All Implemented Interfaces:
MessageListener,java.lang.Runnable,java.util.EventListener
public class HealthMonitor extends java.lang.Object implements MessageListener, java.lang.Runnable
HealthMonitor utilizes MasterNode to determine self designation. All nodes cache other node's states, and can act as a master node at any given point in time. The intention behind the designation is that no node other than the master node should determine collective state and communicate it to group members.TODO: Convert the InDoubt Peer Determination and Failure Verification into Callable FutureTask using java.util.concurrent
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHealthMonitor.PeerMachineConnectionResultThis method is for designating myself in network isolation if my network interface is not up.
-
Field Summary
Fields Modifier and Type Field Description static shortCLUSTERSTOPPINGstatic shortDEADstatic longDEFAULT_MEMBERSTATE_TIMEOUTstatic java.lang.StringHEALTHMbooleanoutstandingFailureToVerifystatic shortPEERSTOPPINGstatic shortSTOPPED
-
Constructor Summary
Constructors Constructor Description HealthMonitor(ClusterManager manager, long timeout, int maxMissedBeats, long verifyTimeout, long failureDetectionTCPTimeout, int failureDetectionTCPPort)Constructor for the HealthMonitor object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddHealthEntryIfMissing(SystemAdvertisement adv)voidannounceWatchdogObservedFailure(java.lang.String failedMemberToken)longgetIndoubtDuration()A member is considered INDOUBT when a heartbeat has not been received in this amout of time.java.lang.StringgetMemberState(PeerID peerID, long threshold, long timeout)java.lang.StringgetMemberStateFromHeartBeat(PeerID peerID, long threshold)java.lang.StringgetMemberStateViaLWR(PeerID peerID, long timeout)com.sun.enterprise.mgmt.HealthMonitor.MsgSendStatsgetMsgSendStats(java.lang.String memberName)intgetType()Returns the message type whichMessageis supporting i.g.booleanisConnected(HealthMessage.Entry entry)voidreceiveMessageEvent(MessageEvent event)Processing aMessageEventvoidreportJoinedAndReadyState()voidrun()Main processing method for the HealthMonitor objectvoidsetJoinedAndReadyReceived()
-
-
-
Field Detail
-
CLUSTERSTOPPING
public static final short CLUSTERSTOPPING
- See Also:
- Constant Field Values
-
PEERSTOPPING
public static final short PEERSTOPPING
- See Also:
- Constant Field Values
-
STOPPED
public static final short STOPPED
- See Also:
- Constant Field Values
-
DEAD
public static final short DEAD
- See Also:
- Constant Field Values
-
HEALTHM
public static final java.lang.String HEALTHM
- See Also:
- Constant Field Values
-
outstandingFailureToVerify
public volatile boolean outstandingFailureToVerify
-
DEFAULT_MEMBERSTATE_TIMEOUT
public static final long DEFAULT_MEMBERSTATE_TIMEOUT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HealthMonitor
public HealthMonitor(ClusterManager manager, long timeout, int maxMissedBeats, long verifyTimeout, long failureDetectionTCPTimeout, int failureDetectionTCPPort)
Constructor for the HealthMonitor object- Parameters:
manager- the ClusterManagermaxMissedBeats- Maximum retries before failureverifyTimeout- timeout in milliseconds that the health monitor waits before finalizing that the in doubt peer is dead.timeout- in milliseconds that the health monitor waits before retrying an indoubt peer's availability.failureDetectionTCPPort- the tcp port of failure DetectionfailureDetectionTCPTimeout- the timeout to detect the failure
-
-
Method Detail
-
getIndoubtDuration
public long getIndoubtDuration()
A member is considered INDOUBT when a heartbeat has not been received in this amout of time. (in milliseconds.)- Returns:
- the duration
-
receiveMessageEvent
public void receiveMessageEvent(MessageEvent event) throws MessageIOException
Processing aMessageEvent- Specified by:
receiveMessageEventin interfaceMessageListener- Parameters:
event- a received message event- Throws:
MessageIOException- if I/O error occurs
-
getType
public int getType()
Description copied from interface:MessageListenerReturns the message type whichMessageis supporting i.g.Message.TYPE_CLUSTER_MANAGER_MESSAGEorMessage.TYPE_HEALTH_MONITOR_MESSAGE's integer value or etc...- Specified by:
getTypein interfaceMessageListener- Returns:
- the message type about which this listener is concerned
-
run
public void run()
Main processing method for the HealthMonitor object- Specified by:
runin interfacejava.lang.Runnable
-
getMemberState
public java.lang.String getMemberState(PeerID peerID, long threshold, long timeout)
- Parameters:
peerID- is the peer idthreshold- is a positive value if the user wants to look at the caller's local cache to get the statetimeout- is a positive value if the user desires to make a network call directly to the member whose state it wants if both the above parameters are specified, then fisrt attempt is to get the state from the local cache. If it comes back as UNKNOWN, then another attempt is made via LWR multicast to get the state directly from the concerned member.- Returns:
- state
-
getMemberStateFromHeartBeat
public java.lang.String getMemberStateFromHeartBeat(PeerID peerID, long threshold)
-
getMemberStateViaLWR
public java.lang.String getMemberStateViaLWR(PeerID peerID, long timeout)
-
addHealthEntryIfMissing
public boolean addHealthEntryIfMissing(SystemAdvertisement adv)
-
reportJoinedAndReadyState
public void reportJoinedAndReadyState()
-
isConnected
public boolean isConnected(HealthMessage.Entry entry)
-
announceWatchdogObservedFailure
public void announceWatchdogObservedFailure(java.lang.String failedMemberToken)
-
setJoinedAndReadyReceived
public void setJoinedAndReadyReceived()
-
getMsgSendStats
public com.sun.enterprise.mgmt.HealthMonitor.MsgSendStats getMsgSendStats(java.lang.String memberName)
-
-