com.sun.enterprise.mgmt
Class HealthMonitor

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

public class HealthMonitor
extends Object
implements MessageListener, 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
static class HealthMonitor.PeerMachineConnectionResult
          This method is for designating myself in network isolation if my network interface is not up.
 
Field Summary
static short CLUSTERSTOPPING
           
static short DEAD
           
static long DEFAULT_MEMBERSTATE_TIMEOUT
           
static String HEALTHM
           
 boolean outstandingFailureToVerify
           
static short PEERSTOPPING
           
static short STOPPED
           
 
Constructor Summary
HealthMonitor(ClusterManager manager, long timeout, int maxMissedBeats, long verifyTimeout, long failureDetectionTCPTimeout, int failureDetectionTCPPort)
          Constructor for the HealthMonitor object
 
Method Summary
 boolean addHealthEntryIfMissing(SystemAdvertisement adv)
           
 void announceWatchdogObservedFailure(String failedMemberToken)
           
 long getIndoubtDuration()
          A member is considered INDOUBT when a heartbeat has not been received in this amout of time.
 String getMemberState(PeerID peerID, long threshold, long timeout)
           
 String getMemberStateFromHeartBeat(PeerID peerID, long threshold)
           
 String getMemberStateViaLWR(PeerID peerID, long timeout)
           
 com.sun.enterprise.mgmt.HealthMonitor.MsgSendStats getMsgSendStats(String memberName)
           
 int getType()
          Returns the message type which Message is supporting i.g.
 boolean isConnected(HealthMessage.Entry entry)
           
 void receiveMessageEvent(MessageEvent event)
          Processing a MessageEvent
 void reportJoinedAndReadyState()
           
 void run()
          Main processing method for the HealthMonitor object
 void setJoinedAndReadyReceived()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 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 ClusterManager
maxMissedBeats - Maximum retries before failure
verifyTimeout - 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.
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.)


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

run

public void run()
Main processing method for the HealthMonitor object

Specified by:
run in interface Runnable

getMemberState

public String getMemberState(PeerID peerID,
                             long threshold,
                             long timeout)
Parameters:
peerID -
threshold - is a positive value if the user wants to look at the caller's local cache to get the state
timeout - 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 String getMemberStateFromHeartBeat(PeerID peerID,
                                          long threshold)

getMemberStateViaLWR

public 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(String failedMemberToken)

setJoinedAndReadyReceived

public void setJoinedAndReadyReceived()

getMsgSendStats

public com.sun.enterprise.mgmt.HealthMonitor.MsgSendStats getMsgSendStats(String memberName)


Copyright © 2012. All Rights Reserved.