Java Reference
In-Depth Information
should use this method when adding a listener from outside the agent—a man-
agement application or other program.
The ObjectName argument must correspond to a registered MBean that is a
NotificationBroadcaster . This method throws a single exception: an Instance-
NotFoundException indicating that the broadcaster MBean could not be found
given the ObjectName value.
The addNotificationListener( ObjectName name, ObjectName listener,
NotificationFilter filter, Object handback ) method
The second version of the addNotificationListener() method takes two Object-
Name instances; the remaining arguments are the same as for the previous
method. You would use this method when one MBean needs to listen for another
MBean's notifications. This technique has many uses: for example, you might
want to aggregate all notifications in one place, or you might have an MBean
that listens for notifications and persists the ones it receives.
The first ObjectName argument corresponds to the MBean emitting notifica-
tions, and the second corresponds to another MBean registered in the MBean
server. The second ObjectName must correspond to a registered MBean that is
also a NotificationListener . This method has the same exceptions as the previ-
ous method.
The removeNotificationListener( ObjectName name,
NotificationListener listener ) method
The removeNotificationListener() method accepts an ObjectName correspond-
ing to a registered MBean that is also a NotificationBroadcaster . The Notifica-
tionListener parameter indicates which listener the MBean must remove from
its listener list. After invoking this method successfully, a listener will not receive
any more notifications from this MBean.
The remove methods can throw an exception in addition to those thrown by
the add listener methods: the ListenerNotFoundException exception indicates
that the supplied listener could not be found on the supplied MBean.
The removeNotificationListener( ObjectName name,
ObjectName listener ) method
Similar to the second add listener method, this method tells a registered MBean
NotificationBroadcaster to remove the NotificationListener registered with
the MBean server with the supplied ObjectName instance.
Search WWH ::




Custom Search