| java.lang.Object javax.management.NotificationBroadcasterSupport
All known Subclasses: javax.management.relation.RelationService, org.huihoo.jfox.service.ComponentSupport, javax.management.timer.Timer, javax.management.monitor.Monitor, example.jmx.notification.SimpleNotification,
NotificationBroadcasterSupport | public class NotificationBroadcasterSupport implements NotificationEmitter(Code) | | Provides an implementation of
javax.management.NotificationEmitter NotificationEmitter interface. This can be used as the super class of an MBean that
sends notifications.
It is not specified whether the notification dispatch model is
synchronous or asynchronous. That is, when a thread calls
NotificationBroadcasterSupport.sendNotification sendNotification , the
NotificationListener.handleNotificationNotificationListener.handleNotification method of each listener
may be called within that thread (a synchronous model) or within
some other thread (an asynchronous model).
Applications should not depend on notification dispatch being
synchronous or being asynchronous. Thus:
- Applications should not assume a synchronous model. When the
NotificationBroadcasterSupport.sendNotification sendNotification method returns, it is
not guaranteed that every listener's
NotificationListener.handleNotification handleNotification method
has been called. It is not guaranteed either that a listener will
see notifications in the same order as they were generated.
Listeners that depend on order should use the sequence number of
notifications to determine their order (see
Notification.getSequenceNumber ).
- Applications should not assume an asynchronous model. If the
actions performed by a listener are potentially slow, the listener
should arrange for them to be performed in another thread, to avoid
holding up other listeners and the caller of
NotificationBroadcasterSupport.sendNotification sendNotification .
author: Young Yang |
NotificationBroadcasterSupport | public NotificationBroadcasterSupport()(Code) | | |
addNotificationListener | public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)(Code) | | Adds a listener.
Parameters: listener - The listener to receive notifications. Parameters: filter - The filter object. If filter is null, no filtering will be performed before handling notifications. Parameters: handback - An opaque object to be sent back to the listener when a notification is emitted. This objectcannot be used by the Notification broadcaster object. It should be resent unchanged with the notificationto the listener. exception: IllegalArgumentException - thrown if the istener is null. See Also: NotificationBroadcasterSupport.removeNotificationListener |
getNotificationInfo | public MBeanNotificationInfo[] getNotificationInfo()(Code) | | Returns a NotificationInfo object contaning the name of the Java class of the notification
and the notification types sent.
|
handleNotification | protected void handleNotification(NotificationListener listener, Notification notif, Object handback)(Code) | | This method is called by
NotificationBroadcasterSupport.sendNotificationsendNotification for each listener in order to send the
notification to that listener. It can be overridden in
subclasses to change the behaviour of notification delivery,
for instance to deliver the notification in a separate
thread.
It is not guaranteed that this method is called by the same
thread as the one that called
NotificationBroadcasterSupport.sendNotificationsendNotification .
The default implementation of this method is equivalent to
listener.handleNotification(notif, handback);
Parameters: listener - the listener to which the notification is beingdelivered. Parameters: notif - the notification being delivered to the listener. Parameters: handback - the handback object that was supplied when thelistener was added. since: JMX 1.2 |
removeNotificationListener | public synchronized void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException(Code) | | Removes a listener. Note that if the listener has been registered with different handback
objects or notification filters, all entries corresponding to the listener will be removed.
Parameters: listener - the listener to receive notifications. throws: ListenerNotFoundException - |
sendNotification | public void sendNotification(Notification notification)(Code) | | Sends a notification. A listener will be removed if an exception appears when calling
the listener's handleNotification method.
Parameters: notification - |
|
|