Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.management.monitor
Class CounterMonitor

    java.lang.Object
      |
      +--javax.management.NotificationBroadcasterSupport
            |
            +--javax.management.monitor.Monitor
                  |
                  +--javax.management.monitor.CounterMonitor

public class CounterMonitor
extends Monitor
implements CounterMonitorMBean

This class 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, i.e. 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, then 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, then 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 then 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:

- if (counter[t] - counter[t-GP]) is positive then V[t] = counter[t] - counter[t-GP]
- if (counter[t] - counter[t-GP]) is negative then V[t] = counter[t] - counter[t-GP] + MODULUS

This implementation of the counter monitor requires the observed attribute to be of type integer.

See Also:
  Serialized Form

Fields inherited from class javax.management.monitor.Monitor
`alreadyNotified, dbgTag, OBSERVED_ATTRIBUTE_ERROR_NOTIFIED, OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED, OBSERVED_OBJECT_ERROR_NOTIFIED, RESET_FLAGS_ALREADY_NOTIFIED, RUNTIME_ERROR_NOTIFIED, server`

Constructor Summary
`CounterMonitor()` Default constructor.

Method Summary
`java.lang.Number` | `getDerivedGauge()` Gets the derived gauge.
`java.util.Date` | `getDerivedGaugeTimeStamp()` Gets the derived gauge timestamp.
`boolean` | `getDifferenceMode()` Gets the difference mode flag value.
`java.lang.Number` | `getModulus()` Gets the modulus value.
`MBeanNotificationInfo[]` | `getNotificationInfo()` Returns a NotificationInfo object contaning the name of the Java class of the notification and the notification types sent.
`boolean` | `getNotify()` Gets the notifications on/off switch value.
`java.lang.Number` | `getOffset()` Gets the offset value.
`java.lang.Number` | `getThreshold()` Gets the threshold value.
`void` | `preDeregister()` Allows the Monitor MBean to perform any operations it needs before being de-registered by the MBean server.
`void` | `setDifferenceMode(boolean value)` Sets the difference mode flag value.
`void` | `setModulus(java.lang.Number value)` Sets the modulus value.
`void` | `setNotify(boolean value)` Sets the notifications on/off switch value.
`void` | `setOffset(java.lang.Number value)` Sets the offset value.
`void` | `setThreshold(java.lang.Number value)` Sets the threshold value.
`void` | `start()` Starts the CounterMonitor.
`void` | `stop()` Stops the CounterMonitor.

Methods inherited from class javax.management.monitor.Monitor
`getGranularityPeriod, getObservedAttribute, getObservedObject, isActive, postDeregister, postRegister, preRegister, setGranularityPeriod, setObservedAttribute, setObservedObject`

Methods inherited from class javax.management.NotificationBroadcasterSupport
`addNotificationListener, removeNotificationListener, sendNotification`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CounterMonitor

    public CounterMonitor()

  Default constructor.

Method Detail

### preDeregister

    public void preDeregister()
                       throws java.lang.Exception

  Allows the Monitor MBean to perform any operations it needs before being de-registered by the MBean server.

  Resets the threshold values.

  Throws:
    java.lang.Exception -
  Overrides:
    preDeregister in class Monitor

### start

    public void start()

  Starts the CounterMonitor.
  Overrides:
    start in class Monitor

### stop

    public void stop()

  Stops the CounterMonitor.
  Overrides:
    stop in class Monitor

### getDerivedGauge

    public java.lang.Number getDerivedGauge()

  Gets the derived gauge.
  Specified by:
    getDerivedGauge in interface CounterMonitorMBean
  Returns:
    The derived gauge.

### getDerivedGaugeTimeStamp

    public java.util.Date getDerivedGaugeTimeStamp()

  Gets the derived gauge timestamp.
  Specified by:
    getDerivedGaugeTimeStamp in interface CounterMonitorMBean
  Returns:
    The derived gauge timestamp.

### getThreshold

    public java.lang.Number getThreshold()

  Gets the threshold value.
  Specified by:
    getThreshold in interface CounterMonitorMBean
  Returns:
    The threshold value.

### setThreshold

    public void setThreshold(java.lang.Number value)
                      throws java.lang.IllegalArgumentException

  Sets the threshold value.
  Specified by:
    setThreshold in interface CounterMonitorMBean
  Parameters:
    `value` - The threshold value.
  Throws:
    java.lang.IllegalArgumentException - The specified threshold is null or the threshold value is less than zero.

### getOffset

    public java.lang.Number getOffset()

  Gets the offset value.
  Specified by:
    getOffset in interface CounterMonitorMBean
  Returns:
    The offset value.

### setOffset

    public void setOffset(java.lang.Number value)
                   throws java.lang.IllegalArgumentException

  Sets the offset value.
  Specified by:
    setOffset in interface CounterMonitorMBean
  Parameters:
    `value` - The offset value.
  Throws:
    java.lang.IllegalArgumentException - The specified offset is null or the offset value is less than zero.

### getModulus

    public java.lang.Number getModulus()

  Gets the modulus value.
  Specified by:
    getModulus in interface CounterMonitorMBean
  Returns:
    The modulus value.

### setModulus

    public void setModulus(java.lang.Number value)
                    throws java.lang.IllegalArgumentException

  Sets the modulus value.
  Specified by:
    setModulus in interface CounterMonitorMBean
  Parameters:
    `value` - The modulus value.
  Throws:
    java.lang.IllegalArgumentException - The specified modulus is null or the modulus value is less than zero.

### getNotify

    public boolean getNotify()

  Gets the notifications on/off switch value.
  Specified by:
    getNotify in interface CounterMonitorMBean
  Returns:
    True if the CounterMonitor notifies when exceeding the threshold, false otherwise.

### setNotify

    public void setNotify(boolean value)

  Sets the notifications on/off switch value.
  Specified by:
    setNotify in interface CounterMonitorMBean
  Parameters:
    `value` - The notifications on/off switch value.

### getDifferenceMode

    public boolean getDifferenceMode()

  Gets the difference mode flag value.
  Specified by:
    getDifferenceMode in interface CounterMonitorMBean
  Returns:
    True if the difference mode is used, false otherwise.

### setDifferenceMode

    public void setDifferenceMode(boolean value)

  Sets the difference mode flag value.
  Specified by:
    setDifferenceMode in interface CounterMonitorMBean
  Parameters:
    `value` - The difference mode flag value.

### getNotificationInfo

    public MBeanNotificationInfo[] getNotificationInfo()

  Returns a NotificationInfo object contaning the name of the Java class of the notification and the notification types sent.
  Overrides:
    getNotificationInfo in class NotificationBroadcasterSupport

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD