Java Reference
In-Depth Information
Remember that all monitors create a derived gauge value based on the value
of their observations. In the String monitor case, the derived gauge value is
always the value of the observed attribute.
Using the String monitor
You will develop a working example of this monitor after we discuss the remain-
ing two monitors. However, we will mention its important methods now. A
StringMonitor MBean's behavior is based on three values configured by the user.
These values are configured by the invocation of the following methods:
setStringToCompare( String ) —Sets the internal String value to compare
with the observed attribute
setNotifyDiffer( boolean ) —Tells the monitor to send a notification when
the observed attribute changes to a non-matching value
setNotifiyMatch( boolean ) —Tells the monitor to send a notification when
the observed attribute changes to a matching value
After setting the monitor MBean's StringToCompare attribute (and after config-
uring the observed MBean and attribute), you can invoke the monitor's start()
method to begin observations. Remember, the monitor will send notifications
(based on its configuration) only when the attribute transitions from a match to a
non-match or vice versa. It will not continuously send notifications if the value
always matches or always differs.
StringMonitor notifications
Based on the two events described in section 12.1.2, String monitors can send
two more notification types in addition to the common notification types
described in section 12.1.1. Recall that all monitors use the MonitorNotification
class for sending notifications.
The following two types could be sent from a StringMonitor MBean that's
operating normally:
jmx.monitor.string.matches —Indicates that the monitor's observed attribute
has changed to a matching value
jmx.monitor.string.differs —Indicates that the monitor's observed attribute
has changed to a differing value
You will see an example of the String monitor shortly. The next section covers
the Gauge monitor MBean.
Search WWH ::




Custom Search