Class: javax.management.monitor.Monitor
- public abstract class Monitor
- extends NotificationBroadcasterSupport
- implements MonitorMBean, MBeanRegistration
Defines the part common to all monitor MBeans.
A monitor MBean monitors values of an attribute common to a set of observed
MBeans. The observed attribute is monitored at intervals specified by the
granularity period. A gauge value (derived gauge) is derived from the values
of the observed attribute.
Inheritance
Superclass tree:- java.lang.Object
- javax.management.NotificationBroadcasterSupport
- javax.management.monitor.Monitor
Methods
-
Monitortop
public Monitor() -
addObservedObjecttop
public synchronized void addObservedObject(ObjectName object) throws IllegalArgumentExceptionAdds the specified object in the set of observed MBeans, if this object is not already present.- Specified by:
- addObservedObject from MonitorMBean
-
containsObservedObjecttop
public synchronized boolean containsObservedObject(ObjectName object)Tests whether the specified object is in the set of observed MBeans.- Specified by:
- containsObservedObject from MonitorMBean
-
getGranularityPeriodtop
public synchronized long getGranularityPeriod()Gets the granularity period (in milliseconds).
The default value of the granularity period is 10 seconds.- Specified by:
- getGranularityPeriod from MonitorMBean
-
getObservedAttributetop
public synchronized String getObservedAttribute()Gets the attribute being observed.
The observed attribute is not initialized by default (set to null).- Specified by:
- getObservedAttribute from MonitorMBean
-
getObservedObjecttop
public synchronized ObjectName getObservedObject()Returns the object name of the first object in the set of observed MBeans, ornullif there is no such object.- Specified by:
- getObservedObject from MonitorMBean
-
getObservedObjectstop
public synchronized ObjectName[] getObservedObjects()Returns an array containing the objects being observed.- Specified by:
- getObservedObjects from MonitorMBean
-
isActivetop
public synchronized boolean isActive()- Specified by:
- isActive from MonitorMBean
-
postDeregistertop
public void postDeregister()Allows the monitor MBean to perform any operations needed after having been unregistered by the MBean server.Not used in this context.
- Specified by:
- postDeregister from MBeanRegistration
-
postRegistertop
public void postRegister(Boolean registrationDone)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 from MBeanRegistration
-
preDeregistertop
public void preDeregister() throws ExceptionAllows the monitor MBean to perform any operations it needs before being unregistered by the MBean server.Stops the monitor.
- Specified by:
- preDeregister from MBeanRegistration
-
preRegistertop
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 from MBeanRegistration
-
removeObservedObjecttop
public synchronized void removeObservedObject(ObjectName object)Removes the specified object from the set of observed MBeans.- Specified by:
- removeObservedObject from MonitorMBean
-
setGranularityPeriodtop
public synchronized void setGranularityPeriod(long period) throws IllegalArgumentExceptionSets the granularity period (in milliseconds).
The default value of the granularity period is 10 seconds.- Specified by:
- setGranularityPeriod from MonitorMBean
-
setObservedAttributetop
public void setObservedAttribute(String attribute) throws IllegalArgumentExceptionSets the attribute to observe.
The observed attribute is not initialized by default (set to null).- Specified by:
- setObservedAttribute from MonitorMBean
-
setObservedObjecttop
public synchronized void setObservedObject(ObjectName object) throws IllegalArgumentExceptionRemoves all objects from the set of observed objects, and then adds the specified object.- Specified by:
- setObservedObject from MonitorMBean
-
starttop
public abstract void start()Starts the monitor.- Specified by:
- start from MonitorMBean
-
stoptop
public abstract void stop()Stops the monitor.- Specified by:
- stop from MonitorMBean
Fields
-
OBSERVED_ATTRIBUTE_ERROR_NOTIFIED
static final protected int OBSERVED_ATTRIBUTE_ERROR_NOTIFIED = 2Flag 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
static final protected int OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED = 4Flag 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
static final protected int OBSERVED_OBJECT_ERROR_NOTIFIED = 1Flag denoting that a notification has occurred after changing the observed object. This flag is used to check that the new observed object is registered in the MBean server at the time of the first notification. -
RESET_FLAGS_ALREADY_NOTIFIED
static final protected int RESET_FLAGS_ALREADY_NOTIFIED = 0This flag is used to reset the alreadyNotifieds monitor attribute. -
RUNTIME_ERROR_NOTIFIED
static final protected int RUNTIME_ERROR_NOTIFIED = 8Flag 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. -
alreadyNotified
protected int alreadyNotifiedMonitor errors that have already been notified. -
alreadyNotifieds
protected int[] alreadyNotifiedsSelected monitor errors that have already been notified.
Each element in this array corresponds to an observed object in the vector. It contains a bit mask of the flags javax.management.monitor.Monitor.OBSERVED_OBJECT_ERROR_NOTIFIED etc, indicating whether the corresponding notification has already been sent for the MBean being monitored.
-
capacityIncrement
static final protected int capacityIncrement = 16The amount by which the capacity of the monitor arrays are automatically incremented when their size becomes greater than their capacity. -
dbgTag
protected String dbgTagThis field is retained for compatibility but should not be referenced. -
elementCount
protected int elementCountThe number of valid components in the vector of observed objects. -
server
protected MBeanServer serverReference to 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.
