Home » openjdk-7 » javax » management » monitor » [javadoc | source]
javax.management.monitor
public class: CounterMonitor [javadoc | source]
java.lang.Object
   javax.management.NotificationBroadcasterSupport
      javax.management.monitor.Monitor
         javax.management.monitor.CounterMonitor

All Implemented Interfaces:
    CounterMonitorMBean, MonitorMBean, MBeanRegistration, NotificationEmitter

Defines a monitor MBean designed to observe the values of a counter attribute.

A counter monitor sends a threshold notification when the value of the counter reaches or exceeds a threshold known as the comparison level. The notify flag must be set to true.

In addition, an offset mechanism enables particular counting intervals to be detected. If the offset value is not zero, whenever the threshold is triggered by the counter value reaching a comparison level, that comparison level is incremented by the offset value. This is regarded as taking place instantaneously, that is, before the count is incremented. Thus, for each level, the threshold triggers an event notification every time the count increases by an interval equal to the offset value.

If the counter can wrap around its maximum value, the modulus needs to be specified. The modulus is the value at which the counter is reset to zero.

If the counter difference mode is used, the value of the derived gauge is calculated as the difference between the observed counter values for two successive observations. If this difference is negative, the value of the derived gauge is incremented by the value of the modulus. The derived gauge value (V[t]) is calculated using the following method:

This implementation of the counter monitor requires the observed attribute to be of the type integer (Byte, Integer, Short, Long).
Nested Class Summary:
static class  CounterMonitor.CounterMonitorObservedObject   
Fields inherited from javax.management.monitor.Monitor:
capacityIncrement,  elementCount,  alreadyNotified,  alreadyNotifieds,  server,  RESET_FLAGS_ALREADY_NOTIFIED,  OBSERVED_OBJECT_ERROR_NOTIFIED,  OBSERVED_ATTRIBUTE_ERROR_NOTIFIED,  OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED,  RUNTIME_ERROR_NOTIFIED,  dbgTag,  observedObjects,  THRESHOLD_ERROR_NOTIFIED,  INTEGER_ZERO
Constructor:
 public CounterMonitor() 
Method from javax.management.monitor.CounterMonitor Summary:
buildAlarmNotification,   createObservedObject,   getDerivedGauge,   getDerivedGauge,   getDerivedGaugeFromComparable,   getDerivedGaugeTimeStamp,   getDerivedGaugeTimeStamp,   getDifferenceMode,   getInitThreshold,   getModulus,   getNotificationInfo,   getNotify,   getOffset,   getThreshold,   getThreshold,   isComparableTypeValid,   isThresholdTypeValid,   onErrorNotification,   setDifferenceMode,   setInitThreshold,   setModulus,   setNotify,   setOffset,   setThreshold,   start,   stop
Methods from javax.management.monitor.Monitor:
addObservedObject,   buildAlarmNotification,   buildErrorNotification,   classForType,   computeAlreadyNotifiedIndex,   containsObservedObject,   createAlreadyNotified,   createObservedObject,   doStart,   doStop,   getAttribute,   getComparableFromAttribute,   getDerivedGauge,   getDerivedGaugeFromComparable,   getDerivedGaugeTimeStamp,   getGranularityPeriod,   getObservedAttribute,   getObservedObject,   getObservedObject,   getObservedObjects,   isActive,   isAlreadyNotified,   isComparableTypeValid,   isThresholdTypeValid,   isValidForType,   onErrorNotification,   postDeregister,   postRegister,   preDeregister,   preRegister,   removeObservedObject,   resetAllAlreadyNotified,   resetAlreadyNotified,   setAlreadyNotified,   setGranularityPeriod,   setObservedAttribute,   setObservedObject,   start,   stop,   updateAlreadyNotified,   updateDeprecatedAlreadyNotified
Methods from javax.management.NotificationBroadcasterSupport:
addNotificationListener,   getNotificationInfo,   handleNotification,   removeNotificationListener,   removeNotificationListener,   sendNotification
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.management.monitor.CounterMonitor Detail:
 synchronized MonitorNotification buildAlarmNotification(ObjectName object,
    String attribute,
    Comparable<?> value) 
 ObservedObject createObservedObject(ObjectName object) 
    Factory method for ObservedObject creation.
 public synchronized Number getDerivedGauge() 
Deprecated! As - of JMX 1.2, replaced by #getDerivedGauge(ObjectName)

    Returns the derived gauge of the first object in the set of observed MBeans.
 public synchronized Number getDerivedGauge(ObjectName object) 
    Gets the derived gauge of the specified object, if this object is contained in the set of observed MBeans, or null otherwise.
 synchronized Comparable<?> getDerivedGaugeFromComparable(ObjectName object,
    String attribute,
    Comparable<?> value) 
 public synchronized long getDerivedGaugeTimeStamp() 
Deprecated! As - of JMX 1.2, replaced by #getDerivedGaugeTimeStamp(ObjectName)

    Gets the derived gauge timestamp of the first object in the set of observed MBeans.
 public synchronized long getDerivedGaugeTimeStamp(ObjectName object) 
    Gets the derived gauge timestamp of the specified object, if this object is contained in the set of observed MBeans, or 0 otherwise.
 public synchronized boolean getDifferenceMode() 
    Gets the difference mode flag value common to all observed MBeans.
 public synchronized Number getInitThreshold() 
    Gets the initial threshold value common to all observed objects.
 public synchronized Number getModulus() 
    Gets the modulus value common to all observed MBeans.
 public MBeanNotificationInfo[] getNotificationInfo() 
    Returns a NotificationInfo object containing the name of the Java class of the notification and the notification types sent by the counter monitor.
 public synchronized boolean getNotify() 
    Gets the notification's on/off switch value common to all observed MBeans.
 public synchronized Number getOffset() 
    Gets the offset value common to all observed MBeans.
 public synchronized Number getThreshold() 
Deprecated! As - of JMX 1.2, replaced by #getThreshold(ObjectName)

    Gets the threshold value of the first object in the set of observed MBeans.
 public synchronized Number getThreshold(ObjectName object) 
    Gets the current threshold value of the specified object, if this object is contained in the set of observed MBeans, or null otherwise.
 synchronized boolean isComparableTypeValid(ObjectName object,
    String attribute,
    Comparable<?> value) 
    This method globally sets the derived gauge type for the given "object" and "attribute" after checking that the type of the supplied observed attribute value is one of the value types supported by this monitor.
 synchronized boolean isThresholdTypeValid(ObjectName object,
    String attribute,
    Comparable<?> value) 
    Tests if the threshold, offset and modulus of the specified observed object are of the same type as the counter. Only integer types are allowed. Note: If the optional offset or modulus have not been initialized, their default value is an Integer object with a value equal to zero.
 synchronized  void onErrorNotification(MonitorNotification notification) 
 public synchronized  void setDifferenceMode(boolean value) 
    Sets the difference mode flag value common to all observed MBeans.
 public synchronized  void setInitThreshold(Number value) throws IllegalArgumentException 
    Sets the initial threshold value common to all observed objects.
    The current threshold of every object in the set of observed MBeans is updated consequently.
 public synchronized  void setModulus(Number value) throws IllegalArgumentException 
    Sets the modulus value common to all observed MBeans.
 public synchronized  void setNotify(boolean value) 
    Sets the notification's on/off switch value common to all observed MBeans.
 public synchronized  void setOffset(Number value) throws IllegalArgumentException 
    Sets the offset value common to all observed MBeans.
 public synchronized  void setThreshold(Number value) throws IllegalArgumentException 
Deprecated! As - of JMX 1.2, replaced by #setInitThreshold

    Sets the initial threshold value.
 public synchronized  void start() 
    Starts the counter monitor.
 public synchronized  void stop() 
    Stops the counter monitor.