Java Reference
In-Depth Information
6.2 Components of the JMX notification model
If you have worked with the Java event model, then using the JMX notification
model will come easily. MBean events are wrapped as notification objects and
broadcast from MBeans. Notification listeners, like event listeners, register with
MBeans in order to receive notifications. The notification model supports send-
ing many different types of notifications, including user-defined notifications.
One noticeable difference between the notification model and the event model is
that notification listeners register only once with an MBean to receive all types of
notifications. In addition, when registering for notifications, listeners can
optionally provide a filter object that indicates the types of notifications in which
the listener is interested (we talk about notifications filters in a moment).
Table 6.1 lists the four major components of the JMX notification model.
Table 6.1 The four components of the JMX notification model. Some of these components are sim-
ilar to those found in the Java event model.
Component
Description
Section
Notification
broadcaster
An object that implements the javax.management.Notification-
Broadcaster interface, allowing it to send notifications
6.2.1
Notification
An object emitted from broadcasters that contain information for a listener
6.2.3
Notification
listener
An object that implements the javax.management.Notification-
Listener interface, allowing it to receive notifications
6.2.4
Notification
filter
An object associated with a listener that can filter notifications, allowing only
the desired notifications to be delivered to a listener
6.2.5
We discuss the four components in the following sections. After covering each
component, you will begin writing some examples.
6.2.1
Being a notification broadcaster
A notification broadcaster is an MBean that implements the javax.manage-
ment.NotificationBroadcaster interface. Classes can implement the interface or
inherit the implementation from a super class. In the HelloWorld example from
chapter 2, the HelloWorld MBean became a notification broadcaster when it
extended the javax.management.NotificationBroadcasterSupport class. This
support class provided the HelloWorld MBean with an implementation of the
NotificationBroadcaster interface.
Search WWH ::




Custom Search