| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.
Field Summary | |
---|---|
protected int |
alreadyNotified
Monitor errors that have already been notified. |
protected int[] |
alreadyNotifieds
Selected monitor errors that have already been notified. |
protected static int |
capacityIncrement
The amount by which the capacity of the monitor arrays are automatically incremented when their size becomes greater than their capacity. |
protected String |
dbgTag
This field is retained for compatibility but should not be referenced. |
protected int |
elementCount
The number of valid components in the vector of observed objects. |
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. |
protected static int |
RESET_FLAGS_ALREADY_NOTIFIED
This flag is used to reset the javax.management.monitor.Monitor.alreadyNotifieds 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 to the MBean server. |
Constructor Summary | |
---|---|
Monitor() |
Method Summary | |
---|---|
void |
addObservedObject(ObjectName object) Adds the specified object in the set of observed MBeans, if this object is not already present. |
boolean |
containsObservedObject(ObjectName object) Tests whether the specified object is in the set of observed MBeans. |
long |
Gets the granularity period (in milliseconds). |
String |
Gets the attribute being observed. |
ObjectName |
Returns the object name of the first object in the set of observed MBeans, or null if there is no such object.
|
ObjectName[] |
Returns an array containing the objects being observed. |
boolean |
isActive() Tests whether the monitor MBean is active. |
void |
Allows the monitor MBean to perform any operations needed after having been unregistered by the MBean server. |
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. |
void |
Allows the monitor MBean to perform any operations it needs before being unregistered by the MBean server. |
ObjectName |
preRegister(MBeanServer server, ObjectName name) Allows the monitor MBean to perform any operations it needs before being registered in the MBean server. |
void |
removeObservedObject(ObjectName object) Removes the specified object from the set of observed MBeans. |
void |
setGranularityPeriod(long period) Sets the granularity period (in milliseconds). |
void |
setObservedAttribute(String attribute) Sets the attribute to observe. |
void |
setObservedObject(ObjectName object) Removes all objects from the set of observed objects, and then adds the specified object. |
abstract void |
start() Starts the monitor. |
abstract void |
stop() Stops the monitor. |
Methods inherited from class javax.management.NotificationBroadcasterSupport |
---|
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int alreadyNotified
protected int[] alreadyNotifieds
Selected 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 {@link #OBSERVED_OBJECT_ERROR_NOTIFIED} etc, indicating whether the corresponding notification has already been sent for the MBean being monitored.
protected static final int capacityIncrement
protected String dbgTag
protected int elementCount
protected static final int OBSERVED_ATTRIBUTE_ERROR_NOTIFIED
protected static final int OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED
protected static final int OBSERVED_OBJECT_ERROR_NOTIFIED
protected static final int RESET_FLAGS_ALREADY_NOTIFIED
protected static final int RUNTIME_ERROR_NOTIFIED
protected MBeanServer server
Constructor Detail |
---|
public Monitor()
Method Detail |
---|
public synchronized void addObservedObject(ObjectName object) throws IllegalArgumentException
object
- The object to observe.IllegalArgumentException
- The specified object is null.public synchronized boolean containsObservedObject(ObjectName object)
object
- The object to check.true
if the specified object is present,
false
otherwise.public synchronized long getGranularityPeriod()
public synchronized String getObservedAttribute()
public synchronized ObjectName getObservedObject()
null
if there is no such object.
public synchronized ObjectName[] getObservedObjects()
public synchronized boolean isActive()
true
if the monitor MBean is active,
false
otherwise.public void postDeregister()
Not used in this context.
public void postRegister(Boolean registrationDone)
Not used in this context.
registrationDone
public void preDeregister() throws Exception
Stops the monitor.
Exception
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
Initializes the reference to the MBean server.
server
- The MBean server in which the monitor MBean will
be registered.name
- The object name of the monitor MBean.Exception
public synchronized void removeObservedObject(ObjectName object)
object
- The object to remove.public synchronized void setGranularityPeriod(long period) throws IllegalArgumentException
period
- The granularity period value.IllegalArgumentException
- The granularity
period is less than or equal to zero.public void setObservedAttribute(String attribute) throws IllegalArgumentException
attribute
- The attribute to observe.IllegalArgumentException
- The specified
attribute is null.public synchronized void setObservedObject(ObjectName object) throws IllegalArgumentException
object
- The object to observe.IllegalArgumentException
- The specified
object is null.public abstract void start()
public abstract void stop()
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |