public abstract class Monitor extends NotificationBroadcasterSupportimplements MonitorMBean , MBeanRegistration
| Modifier and Type | Field and Description |
|---|---|
protected int |
alreadyNotified
Deprecated.
equivalent to
alreadyNotifieds[0].
|
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
Deprecated.
No replacement.
|
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
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 and Description |
|---|
Monitor()
|
| Modifier and Type | Method and Description |
|---|---|
void |
addObservedObject(ObjectName
Adds the specified object in the set of observed MBeans, if this object is not already present.
|
boolean |
containsObservedObject(ObjectName
Tests whether the specified object is in the set of observed MBeans.
|
long |
getGranularityPeriod()
Gets the granularity period (in milliseconds).
|
String |
getObservedAttribute()
Gets the attribute being observed.
|
ObjectName |
getObservedObject()
Deprecated.
As of JMX 1.2, replaced by
getObservedObjects()
|
ObjectName |
getObservedObjects()
Returns an array containing the objects being observed.
|
boolean |
isActive()
Tests whether the monitor MBean is active.
|
void |
postDeregister()
Allows the monitor MBean to perform any operations needed after having been unregistered by the MBean server.
|
void |
postRegister(Boolean
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()
Allows the monitor MBean to perform any operations it needs before being unregistered by the MBean server.
|
ObjectName |
preRegister(MBeanServer
Allows the monitor MBean to perform any operations it needs before being registered in the MBean server.
|
void |
removeObservedObject(ObjectName
Removes the specified object from the set of observed MBeans.
|
void |
setGranularityPeriod(long period)
Sets the granularity period (in milliseconds).
|
void |
setObservedAttribute(String
Sets the attribute to observe.
|
void |
setObservedObject(ObjectName
Deprecated.
As of JMX 1.2, replaced by
addObservedObject(javax.management.ObjectName)
|
abstract void |
start()
Starts the monitor.
|
abstract void |
stop()
Stops the monitor.
|
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotificationprotected static final int capacityIncrement
protected int elementCount
@Deprecated protected int alreadyNotified
alreadyNotifieds[0].
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 OBSERVED_OBJECT_ERROR_NOTIFIED etc, indicating whether the corresponding notification has already been sent for the MBean being monitored.
protected MBeanServerserver
protected static final int RESET_FLAGS_ALREADY_NOTIFIED
alreadyNotifieds monitor attribute.
protected static final int OBSERVED_OBJECT_ERROR_NOTIFIED
protected static final int OBSERVED_ATTRIBUTE_ERROR_NOTIFIED
protected static final int OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED
protected static final int RUNTIME_ERROR_NOTIFIED
@Deprecated protected StringdbgTag
public ObjectNamepreRegister(MBeanServer server, ObjectName name) throws Exception
Initializes the reference to the MBean server.
preRegister in interface
MBeanRegistration
server - The MBean server in which the monitor MBean will be registered.
name - The object name of the monitor MBean.
Exception -
public void postRegister(BooleanregistrationDone)
Not used in this context.
postRegister in interface
MBeanRegistration
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.
public void preDeregister()
throws Exception
Stops the monitor.
preDeregister in interface
MBeanRegistration
Exception -
public void postDeregister()
Not used in this context.
public abstract void start()
public abstract void stop()
@Deprecated public ObjectNamegetObservedObject()
getObservedObjects()
null if there is no such object.
getObservedObject in interface
MonitorMBean
setObservedObject(ObjectName)
@Deprecated public void setObservedObject(ObjectNameobject) throws IllegalArgumentException
addObservedObject(javax.management.ObjectName)
setObservedObject in interface
MonitorMBean
object - The object to observe.
IllegalArgumentException - The specified object is null.
getObservedObject()
public void addObservedObject(ObjectNameobject) throws IllegalArgumentException
addObservedObject in interface
MonitorMBean
object - The object to observe.
IllegalArgumentException - The specified object is null.
public void removeObservedObject(ObjectNameobject)
removeObservedObject in interface
MonitorMBean
object - The object to remove.
public boolean containsObservedObject(ObjectNameobject)
containsObservedObject in interface
MonitorMBean
object - The object to check.
true if the specified object is present,
false otherwise.
public ObjectName[] getObservedObjects()
getObservedObjects in interface
MonitorMBean
public StringgetObservedAttribute()
getObservedAttribute in interface
MonitorMBean
setObservedAttribute(java.lang.String)
public void setObservedAttribute(Stringattribute) throws IllegalArgumentException
setObservedAttribute in interface
MonitorMBean
attribute - The attribute to observe.
IllegalArgumentException - The specified attribute is null.
getObservedAttribute()
public long getGranularityPeriod()
getGranularityPeriod in interface
MonitorMBean
setGranularityPeriod(long)
public void setGranularityPeriod(long period)
throws IllegalArgumentException
setGranularityPeriod in interface
MonitorMBean
period - The granularity period value.
IllegalArgumentException - The granularity period is less than or equal to zero.
getGranularityPeriod()
public boolean isActive()
start method is called. It becomes inactive when the
stop method is called.
isActive in interface
MonitorMBean
true if the monitor MBean is active,
false otherwise.