XMOJO 5 API Docs

javax.management.monitor
Class CounterMonitor

java.lang.Object
  |
  +--javax.management.NotificationBroadcasterSupport
        |
        +--javax.management.monitor.Monitor
              |
              +--javax.management.monitor.CounterMonitor
All Implemented Interfaces:
CounterMonitorMBean, MBeanRegistration, MonitorMBean, NotificationBroadcaster, java.io.Serializable

public class CounterMonitor
extends Monitor
implements CounterMonitorMBean

This class defines a monitor MBean designed to observe the values of a counter attribute. Counter attributes are those types whose value is always positive or null and they can only be incremented. The counter monitor is used to observe values of attribute whose type should be of integer i.e. (Byte, Integer, Short, Long).

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:

See Also:
Serialized Form

Fields inherited from class javax.management.monitor.Monitor
alreadyNotified, dgbTag, 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()
          This method gets the value of the derived gauge.
 long getDerivedGaugeTimeStamp()
          This method gets the value of the derived gauge time stamp.The derived gauge time stamp is the value(in the nearest miliseconds) when the notification was triggered.
 boolean getDifferenceMode()
          This method gets the value of the difference mode.
 java.lang.Number getModulus()
          This method gets the modulus value of monitor.
 MBeanNotificationInfo[] getNotificationInfo()
          This method returns a NotificationInfo object containing the name of the Java class of the notification and the notification types sent by the counter monitor.
 boolean getNotify()
          This method gets the notification's on/off switch value.
 java.lang.Number getOffset()
          This method gets the offset value.
 java.lang.Number getThreshold()
          This method gets the value of the threshold.
 void postDeregister()
          This method allows the monitor MBean to perform any operations needed after having been de-registered by the MBean server.
 void postRegister(java.lang.Boolean registrationDone)
          This method allows the monitor MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.
 void preDeregister()
          This method allows the monitor MBean to perform any operations it needs before being de-registered by the MBean server.
 ObjectName preRegister(MBeanServer server, ObjectName name)
          Overriding the preRegister() of MBeanRegistration interface to store the ObjectName locally.
 void setDifferenceMode(boolean value)
          This method sets the state of the difference mode.
 void setModulus(java.lang.Number value)
          This method sets the modulus value of the monitor.
 void setNotify(boolean value)
          This method sets the notification's on/off switch value.
 void setOffset(java.lang.Number value)
          This method sets the value of the offset.
 void setThreshold(java.lang.Number value)
          This method sets the value of the threshold.Threshold is the maximum value of that the attribute can reach.
 void start()
          This method starts the counter monitor.
 void stop()
          This method stops the counter monitor.
 
Methods inherited from class javax.management.monitor.Monitor
getGranularityPeriod, getObservedAttribute, getObservedObject, isActive, 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
 
Methods inherited from interface javax.management.monitor.MonitorMBean
getGranularityPeriod, getObservedAttribute, getObservedObject, isActive, setGranularityPeriod, setObservedAttribute, setObservedObject
 

Constructor Detail

CounterMonitor

public CounterMonitor()
Default Constructor.
Method Detail

getDerivedGauge

public java.lang.Number getDerivedGauge()
This method gets the value of the derived gauge. The derived gauge is either the exact value of the observed attribute , or the difference between the two consecutive observed values of the attribute.
Specified by:
getDerivedGauge in interface CounterMonitorMBean
Returns:
An instance of java.lang.Number giving the value of the derived gauge.

getDerivedGaugeTimeStamp

public long getDerivedGaugeTimeStamp()
This method gets the value of the derived gauge time stamp.The derived gauge time stamp is the value(in the nearest miliseconds) when the notification was triggered.
Specified by:
getDerivedGaugeTimeStamp in interface CounterMonitorMBean
Returns:
long value representing the time the notification was triggered.

getDifferenceMode

public boolean getDifferenceMode()
This method gets the value of the difference mode. If the difference mode is true, the difference mode option is set to calculate the value of the derived gauge.
Specified by:
getDifferenceMode in interface CounterMonitorMBean
Returns:
boolean value indicating whether the difference mode option is set.

setDifferenceMode

public void setDifferenceMode(boolean value)
This method sets the state of the difference mode.
Specified by:
setDifferenceMode in interface CounterMonitorMBean
Parameters:
value - boolean value representing the state of the difference mode.

getModulus

public java.lang.Number getModulus()
This method gets the modulus value of monitor. Modulus is the value at which the counter is reset to zero.
Specified by:
getModulus in interface CounterMonitorMBean
Returns:
An instance of java.lang.Number giving the modulus value.

setModulus

public void setModulus(java.lang.Number value)
                throws java.lang.IllegalArgumentException
This method sets the modulus value of the monitor. Modulus is the value at which the counter is reset to zero.
Specified by:
setModulus in interface CounterMonitorMBean
Parameters:
value - An instance of java.lang.Number representing the modulus value for the derived gauge .
Throws:
java.lang.IllegalArgumentException - - The specified modulus is null or the modulus value is less than zero.

getNotify

public boolean getNotify()
This method gets the notification's on/off switch value.
Specified by:
getNotify in interface CounterMonitorMBean
Returns:
a boolean value indicating the state of notification's On/Off switch.

setNotify

public void setNotify(boolean value)
This method sets the notification's on/off switch value.
Specified by:
setNotify in interface CounterMonitorMBean
Parameters:
value - boolean value to set the sate of the notifications On/Off Switch.

getOffset

public java.lang.Number getOffset()
This method gets the offset value. Offset enables particular counting intervals to be detected.
Specified by:
getOffset in interface CounterMonitorMBean
Returns:
An instance of java.lang.Number giving the value of the offset.

setOffset

public void setOffset(java.lang.Number value)
               throws java.lang.IllegalArgumentException
This method sets the value of the offset.
Specified by:
setOffset in interface CounterMonitorMBean
Parameters:
value - An instance of java.lang.Number giving the value offset.
Throws:
java.lang,IllegalArgumentException - - The specified offset is null or the offset value is less than zero.

getThreshold

public java.lang.Number getThreshold()
This method gets the value of the threshold. Threshold is the maximum value of that the attribute can reach. If the attribute reaches this comparison level or is greater than this level , notification is triggered.
Specified by:
getThreshold in interface CounterMonitorMBean
Returns:
An instance of java.lang.Number giving the value of the threshold.

setThreshold

public void setThreshold(java.lang.Number value)
                  throws java.lang.IllegalArgumentException
This method sets the value of the threshold.Threshold is the maximum value of that the attribute can reach. If the attribute reaches this comparison level or is greater than this level , notification is triggered.
Specified by:
setThreshold in interface CounterMonitorMBean
Parameters:
value - An instance of java.lang.Number which is the value of the threshold.

start

public void start()
This method starts the counter monitor.
Specified by:
start in interface MonitorMBean
Overrides:
start in class Monitor

stop

public void stop()
This method stops the counter monitor.
Specified by:
stop in interface MonitorMBean
Overrides:
stop in class Monitor

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws java.lang.Exception
Overriding the preRegister() of MBeanRegistration interface to store the ObjectName locally.
Overrides:
preRegister in class Monitor
Following copied from class: javax.management.monitor.Monitor
Parameters:
server - - The MBean server in which the monitor MBean will be registered.
name - - The object name of the monitor MBean.
Returns:
This method allows the monitor MBean to perform any operations it needs before being registered in the MBean server.
Throws:
- - java.lang.Exception.

preDeregister

public void preDeregister()
                   throws java.lang.Exception
This method allows the monitor MBean to perform any operations it needs before being de-registered by the MBean server. Stops the monitor.
Overrides:
preDeregister in class Monitor
Following copied from class: javax.management.monitor.Monitor
Throws:
This - operation throws java.lang.Exception

postRegister

public void postRegister(java.lang.Boolean registrationDone)
This method allows the monitor MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed. Not used in this context.
Overrides:
postRegister in class Monitor
Parameters:
registrationDone - If registration is done it is true otherwise false

postDeregister

public void postDeregister()
This method allows the monitor MBean to perform any operations needed after having been de-registered by the MBean server. Not used in this context.
Overrides:
postDeregister in class Monitor

getNotificationInfo

public MBeanNotificationInfo[] getNotificationInfo()
This method returns a NotificationInfo object containing the name of the Java class of the notification and the notification types sent by the counter monitor.
Overrides:
getNotificationInfo in class Monitor
Returns:
An Array of MBeanNotificationInfo objects.

XMOJO 5 API Docs

Copyright ©2003 XMOJO.org. All Rights Reserved.