Java Reference
In-Depth Information
Table 12.1
The three JMX monitor types
Monitor type
Classname
Description
String
Monitors a String attribute
of an MBean
javax.management.monitor.StringMonitor
Gauge
Monitors MBean attributes of
type Float or Double that
can move within a set range of
values (increasing or decreas-
ing)
javax.management.monitor.GaugeMonitor
Counter
Monitors MBean attributes of
type Byte , Integer , Short ,
or Long that act as incremen-
tal counters
javax.management.monitor.CounterMonitor
the specifics and examples of each monitor, we need to examine two things they
all have in common: their super class and notification class.
12.1.1
The monitoring foundation
All JMX monitor MBeans have a common monitor base class and emit notifica-
tion types contained in a common notification class. Before we examine each
specific monitor type, we need to discuss these two classes. The following section
covers the javax.management.monitor.Monitor class, which is the base class for all
the provided JMX monitors.
The Monitor class
As already mentioned, this Monitor class ( javax.management.monitor package) is
the base class for JMX monitor MBeans. It defines common methods that all
monitors need to function properly. In addition, it is defined as an MBean,
allowing subclasses to interact with the MBean server to monitor observed
MBean attributes.
The Monitor class also extends the NotificationBroadcasterSupport class
and implements the MBeanRegistration interface. This ensures that all subclasses
can emit notifications, and that they have a reference to the MBeanServer instance
to which they belong (the reference is gained from the preRegister() method
invocation of the MBeanRegistration interface; we discussed this interface in pre-
vious chapters).
However, the Monitor class is declared as an abstract class; therefore you must
extend it in order to use it. Let's look at the methods of the class before we move
Search WWH ::




Custom Search