|
Préférences
Moteurs de recherche
|
||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.5.0
javax.management
|
Constructor Summary | |
---|---|
NotificationBroadcasterSupport()
|
Method Summary | |
---|---|
void |
addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
Adds a listener. |
MBeanNotificationInfo[] |
getNotificationInfo()
Returns an array indicating, for each notification this MBean may send, the name of the Java class of the notification and the notification type. |
protected void |
handleNotification(NotificationListener listener,
Notification notif,
Object handback)
This method is called by sendNotification for each listener in order to send the
notification to that listener. |
void |
removeNotificationListener(NotificationListener listener)
Removes a listener from this MBean. |
void |
removeNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
Removes a listener from this MBean. |
void |
sendNotification(Notification notification)
Sends a notification. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NotificationBroadcasterSupport()
Method Detail |
---|
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
addNotificationListener
in interface NotificationBroadcaster
listener
- The listener to receive notifications.filter
- The filter object. If filter is null, no filtering will be performed before handling notifications.handback
- An opaque object to be sent back to the listener when a notification is emitted. This object
cannot be used by the Notification broadcaster object. It should be resent unchanged with the notification
to the listener.
IllegalArgumentException
- thrown if the listener is null.removeNotificationListener(javax.management.NotificationListener)
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException
NotificationBroadcaster
removeNotificationListener
in interface NotificationBroadcaster
listener
- A listener that was previously added to this
MBean.
ListenerNotFoundException
- The listener is not
registered with the MBean.NotificationBroadcaster.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
,
NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException
NotificationEmitter
Removes a listener from this MBean. The MBean must have a
listener that exactly matches the given listener
,
filter
, and handback
parameters. If
there is more than one such listener, only one is removed.
The filter
and handback
parameters
may be null if and only if they are null in a listener to be
removed.
removeNotificationListener
in interface NotificationEmitter
listener
- A listener that was previously added to this
MBean.filter
- The filter that was specified when the listener
was added.handback
- The handback that was specified when the listener was
added.
ListenerNotFoundException
- The listener is not
registered with the MBean, or it is not registered with the
given filter and handback.public MBeanNotificationInfo[] getNotificationInfo()
NotificationBroadcaster
Returns an array indicating, for each notification this MBean may send, the name of the Java class of the notification and the notification type.
It is not illegal for the MBean to send notifications not described in this array. However, some clients of the MBean server may depend on the array being complete for their correct functioning.
getNotificationInfo
in interface NotificationBroadcaster
public void sendNotification(Notification notification)
notification
- The notification to send.protected void handleNotification(NotificationListener listener, Notification notif, Object handback)
This method is called by sendNotification
for each listener in order to send the
notification to that listener. It can be overridden in
subclasses to change the behavior 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 sendNotification
.
The default implementation of this method is equivalent to
listener.handleNotification(notif, handback);
listener
- the listener to which the notification is being
delivered.notif
- the notification being delivered to the listener.handback
- the handback object that was supplied when the
listener was added.