com.ibm.websphere.asynchbeans

Interface SubsystemMonitor

All Superinterfaces:
EventSource

  1. public interface SubsystemMonitor
  2. 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.

See Also:
SubsystemMonitorManager, SubsystemMonitorEvents

Field Summary

Modifier and Type Field and Description
  1. static
  2. int
SUBSYSTEM_DEAD
  1. static
  2. int
SUBSYSTEM_FRESH
  1. static
  2. int
SUBSYSTEM_INVALID
  1. static
  2. 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

Modifier and Type Method and Description
  1. void
destroy()
Kill the monitor.
  1. int
getCurrentState()
This returns the last notification sent by the subsystem monitor.
  1. int
getHeartBeatInterval()
The interval in milliseconds between expected heart beats.
  1. int
getMissedBeatsForDead()
The number of missed beats for the subsystem to be regarded as dead.
  1. int
getMissedBeatsForStale()
The number of missed beats for the subsystem to be regarded as stale.
  1. java.lang.String
getName()
The name of the monitor.
  1. java.util.Map
getPropertyMap()
This returns the Map holding the properties for the subsystem monitor.
  1. void
ping()
You must call this periodically to keep the monitor alive.
  1. 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

  1. static final int SUBSYSTEM_DEAD
See Also:

SUBSYSTEM_FRESH

  1. static final int SUBSYSTEM_FRESH
See Also:

SUBSYSTEM_STALE

  1. static final int SUBSYSTEM_STALE
See Also:

SUBSYSTEM_INVALID

  1. static final int SUBSYSTEM_INVALID
See Also:

Method Detail

getPropertyMap

  1. 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

  1. java.lang.String getName()
The name of the monitor.

getMissedBeatsForStale

  1. int getMissedBeatsForStale()
The number of missed beats for the subsystem to be regarded as stale.

getMissedBeatsForDead

  1. int getMissedBeatsForDead()
The number of missed beats for the subsystem to be regarded as dead.

getHeartBeatInterval

  1. int getHeartBeatInterval()
The interval in milliseconds between expected heart beats. A heart beat should result in the ping method being called.

ping

  1. 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

  1. 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

  1. 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

  1. 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)