XMOJO 5 API Docs

javax.management.monitor
Class Monitor

java.lang.Object
  |
  +--javax.management.NotificationBroadcasterSupport
        |
        +--javax.management.monitor.Monitor
All Implemented Interfaces:
MBeanRegistration, MonitorMBean, NotificationBroadcaster, java.io.Serializable
Direct Known Subclasses:
CounterMonitor, GaugeMonitor, StringMonitor

public abstract class Monitor
extends NotificationBroadcasterSupport
implements MonitorMBean, MBeanRegistration, java.io.Serializable

This class is the base class for all types of monitor mbeans.Defines the common part to all monitor MBeans. Using Monitor MBeans, the observed attribute of another MBean (the observed MBean) is monitored at intervals specified by the granularity period. A gauge value (derived gauge) is derived from the values of the observed attribute.

See Also:
Serialized Form

Field Summary
protected  int alreadyNotified
          Selected monitor errors that have already been notified
protected  java.lang.String dgbTag
           
protected static int OBSERVED_ATTRIBUTE_ERROR_NOTIFIED
          Flag denoting that a notification has occurred after changing the observed attribute.
protected static int OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED
          Flag denoting that a notification has occurred after changing the observed object or the observed attribute.
protected static int OBSERVED_OBJECT_ERROR_NOTIFIED
          Flag denoting that a notification has occurred after changing the observed object or the observed attribute.
protected static int RESET_FLAGS_ALREADY_NOTIFIED
          This flag is used to reset the alreadyNotified monitor attribute.
protected static int RUNTIME_ERROR_NOTIFIED
          Flag denoting that a notification has occurred after changing the observed object or the observed attribute.
protected  MBeanServer server
          Reference on the MBean server.
 
Constructor Summary
Monitor()
          Default constructor
 
Method Summary
 long getGranularityPeriod()
          This method gets the granularity period (in milliseconds).
 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.
 java.lang.String getObservedAttribute()
          This method gets the name of the attribute being observed.
 ObjectName getObservedObject()
          This method gets the object name of the object being observed.
 boolean isActive()
          This method tests whether the monitor MBean is active.
 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)
          This method allows the monitor MBean to perform any operations it needs before being registered in the MBean server.
 void setGranularityPeriod(long period)
          This method sets the granularity period (in milliseconds).
 void setObservedAttribute(java.lang.String attribute)
          This method sets the attribute being observed.
 void setObservedObject(ObjectName object)
          This method sets the object name of the object being observed.
abstract  void start()
          This method starts the monitor.
abstract  void stop()
          This method stops the monitor.
 
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
 

Field Detail

alreadyNotified

protected int alreadyNotified
Selected monitor errors that have already been notified

OBSERVED_ATTRIBUTE_ERROR_NOTIFIED

protected static int OBSERVED_ATTRIBUTE_ERROR_NOTIFIED
Flag denoting that a notification has occurred after changing the observed attribute. This flag is used to check that the new observed attribute belongs to the observed object at the time of the first notification.

OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED

protected static int OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED
Flag denoting that a notification has occurred after changing the observed object or the observed attribute. This flag is used to check that the observed attribute type is correct (depending on the monitor in use) at the time of the first notification.

OBSERVED_OBJECT_ERROR_NOTIFIED

protected static int OBSERVED_OBJECT_ERROR_NOTIFIED
Flag denoting that a notification has occurred after changing the observed object or the observed attribute. This flag is used to notify any exception (except the cases described above) when trying to get the value of the observed attribute at the time of the first notification.

RESET_FLAGS_ALREADY_NOTIFIED

protected static int RESET_FLAGS_ALREADY_NOTIFIED
This flag is used to reset the alreadyNotified monitor attribute.

RUNTIME_ERROR_NOTIFIED

protected static int RUNTIME_ERROR_NOTIFIED
Flag denoting that a notification has occurred after changing the observed object or the observed attribute. This flag is used to notify any exception (except the cases described above) when trying to get the value of the observed attribute at the time of the first notification.

server

protected MBeanServer server
Reference on the MBean server. This reference is null when the monitor MBean is not registered in an MBean server. This reference is initialized before the monitor MBean is registered in the MBean server.
See Also:
preRegister(MBeanServer server, ObjectName name)

dgbTag

protected java.lang.String dgbTag
Constructor Detail

Monitor

public Monitor()
Default constructor
Method Detail

getGranularityPeriod

public long getGranularityPeriod()
This method gets the granularity period (in milliseconds).
Specified by:
getGranularityPeriod in interface MonitorMBean
Returns:
long value representing the value of the granularity period (in milliseconds).

setGranularityPeriod

public void setGranularityPeriod(long period)
                          throws java.lang.IllegalArgumentException
This method sets the granularity period (in milliseconds). The default value is one second.
Specified by:
setGranularityPeriod in interface MonitorMBean
Parameters:
period - the granularity period value.
Throws:
java.lang.IllegalArgumentException - - The granularity period is less than or equal to zero.

getObservedAttribute

public java.lang.String getObservedAttribute()
This method gets the name of the attribute being observed.
Specified by:
getObservedAttribute in interface MonitorMBean
Returns:
String The name of the attribute that is being observed.

setObservedAttribute

public void setObservedAttribute(java.lang.String attribute)
                          throws java.lang.IllegalArgumentException
This method sets the attribute being observed.
Specified by:
setObservedAttribute in interface MonitorMBean
Parameters:
attribute - The attribute to be observed.

getObservedObject

public ObjectName getObservedObject()
This method gets the object name of the object being observed.
Specified by:
getObservedObject in interface MonitorMBean
Returns:
The ObjectName of the object being observed.

setObservedObject

public void setObservedObject(ObjectName object)
                       throws java.lang.IllegalArgumentException
This method sets the object name of the object being observed.
Specified by:
setObservedObject in interface MonitorMBean
Parameters:
object - The ObjectName of the object to be observed.
Throws:
IllegalArgumentException. -  

isActive

public boolean isActive()
This method tests whether the monitor MBean is active. A monitor MBean is marked active when the start method is called. It becomes inactive when the stop method is called.
Specified by:
isActive in interface MonitorMBean
Returns:
boolean value indicating whether the MBean is active or not.

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.
Specified by:
postDeregister in interface MBeanRegistration

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.
Specified by:
postRegister in interface MBeanRegistration
Following copied from interface: javax.management.MBeanRegistration
Parameters:
registrationDone - Indicates whether or not the MBean has been successfully registered in the MBean server. The value false means that the registration phase has failed.

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws java.lang.Exception
This method allows the monitor MBean to perform any operations it needs before being registered in the MBean server. Initializes the reference to the MBean server.
Specified by:
preRegister in interface MBeanRegistration
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.
Specified by:
preDeregister in interface MBeanRegistration
Throws:
This - operation throws java.lang.Exception

start

public abstract void start()
This method starts the monitor.
Specified by:
start in interface MonitorMBean

stop

public abstract void stop()
This method stops the monitor.
Specified by:
stop in interface MonitorMBean

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 NotificationBroadcasterSupport
Returns:
An Array of MBeanNotificationInfo objects.

XMOJO 5 API Docs

Copyright ©2003 XMOJO.org. All Rights Reserved.