Interface SubsystemMonitor
-
- All Superinterfaces:
- EventSource
public interface SubsystemMonitor extends EventSource
This represents a subsystem monitor. This is returned to allow an application to interact with the monitor created on its behalf. This is an EventSource so an application can register a listener to it.A subsystem monitor basically is a set of alarms. When it is created, the applications tells it how often heart beats should be expected, how man beats missed means that it's stale and how many beats missed means it's dead. The monitor then sets up alarms to track this status. If the ping method is called then these alarms are reset. If the alarm fires then this means that ping hasn't been called, i.e. no heart beat was received by the application for the subsystem this monitor is 'watching'.
When the number of beats for stale has elapsed without a ping then we fire a stale event. Later, if the number of beats for dead elapse without a ping then we fire a dead event. If a ping is received after a stale or dead notification then we send a fresh event indicating the subsystem is alive again and carry on as normal.
If the stale beats equals the dead beats then no stale event is published, we just publish a dead event. The number of dead beats should always be greater or equal to the number of stale beats. What constitutes a ping is application specific. A destroy notification is also published.
This can generate events. The events which can be generated are documented in the SubsystemMonitorEvents interface. Implement the Events interface and add an instance of this object using the SubsystemMonitor.addListener method.
-
-
Field Summary
Fields Modifier and Type Field and Description static int
SUBSYSTEM_DEAD
static int
SUBSYSTEM_FRESH
static int
SUBSYSTEM_INVALID
static int
SUBSYSTEM_STALE
-
Fields inherited from interface com.ibm.websphere.asynchbeans.EventSource
APPLICATION_NOTIFICATION_EVENT_SOURCE, MAX_LISTENER_SEQUENCE_VALUE, MIN_LISTENER_SEQUENCE_VALUE
-
-
Method Summary
Methods Modifier and Type Method and Description void
destroy()
Kill the monitor.int
getCurrentState()
This returns the last notification sent by the subsystem monitor.int
getHeartBeatInterval()
The interval in milliseconds between expected heart beats.int
getMissedBeatsForDead()
The number of missed beats for the subsystem to be regarded as dead.int
getMissedBeatsForStale()
The number of missed beats for the subsystem to be regarded as stale.java.lang.String
getName()
The name of the monitor.java.util.Map
getPropertyMap()
This returns the Map holding the properties for the subsystem monitor.void
ping()
You must call this periodically to keep the monitor alive.void
start()
The monitor only becomes active, that is starts tracking heart beats when it is started.-
Methods inherited from interface com.ibm.websphere.asynchbeans.EventSource
addListener, addListener, getEventTrigger, getEventTrigger, removeListener
-
-
-
-
Field Detail
-
SUBSYSTEM_DEAD
static final int SUBSYSTEM_DEAD
- See Also:
- Constant Field Values
-
SUBSYSTEM_FRESH
static final int SUBSYSTEM_FRESH
- See Also:
- Constant Field Values
-
SUBSYSTEM_STALE
static final int SUBSYSTEM_STALE
- See Also:
- Constant Field Values
-
SUBSYSTEM_INVALID
static final int SUBSYSTEM_INVALID
- See Also:
- Constant Field Values
-
-
Method Detail
-
getPropertyMap
java.util.Map getPropertyMap()
This returns the Map holding the properties for the subsystem monitor. This is thread safe.- Returns:
- The Map for the properties.
-
getName
java.lang.String getName()
The name of the monitor.
-
getMissedBeatsForStale
int getMissedBeatsForStale()
The number of missed beats for the subsystem to be regarded as stale.
-
getMissedBeatsForDead
int getMissedBeatsForDead()
The number of missed beats for the subsystem to be regarded as dead.
-
getHeartBeatInterval
int getHeartBeatInterval()
The interval in milliseconds between expected heart beats. A heart beat should result in the ping method being called.
-
ping
void ping()
You must call this periodically to keep the monitor alive. Once missed beats for stale are missed then we're stale. Once missed beats for dead are missed then we're dead. The application is responsible for the plumbing to detect the subsystem has sent a heart beat. When the heart beat is detected then the application should call ping on the appropriate monitor.
-
start
void start()
The monitor only becomes active, that is starts tracking heart beats when it is started. Any pings received prior to start being called are ignored.
-
destroy
void destroy()
Kill the monitor. The monitor is not available to the user once destroy is called. A Notification indicating the monitor is about to be destroyed is sent when this method is called.
-
getCurrentState
int getCurrentState()
This returns the last notification sent by the subsystem monitor. Initially this returned dead until the first ping arrives. From that point on it's fresh until it goes stale and the dead. When it revives then it returns fresh again.- Returns:
- one of (SUBSYSTEM_DEAD,SUBSYSTEM_FRESH,SUBSYSTEM_STALE)
-
-