javax.management
Class NotificationBroadcasterSupport

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.management.NotificationBroadcasterSupport
All Implemented Interfaces:
NotificationBroadcaster sample code for javax.management.NotificationBroadcaster definition code for javax.management.NotificationBroadcaster , NotificationEmitter sample code for javax.management.NotificationEmitter definition code for javax.management.NotificationEmitter
Direct Known Subclasses:
JMXConnectorServer sample code for javax.management.remote.JMXConnectorServer definition code for javax.management.remote.JMXConnectorServer , Monitor sample code for javax.management.monitor.Monitor definition code for javax.management.monitor.Monitor , RelationService sample code for javax.management.relation.RelationService definition code for javax.management.relation.RelationService , Timer sample code for javax.management.timer.Timer definition code for javax.management.timer.Timer

public class NotificationBroadcasterSupport
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements NotificationEmitter sample code for javax.management.NotificationEmitter definition code for javax.management.NotificationEmitter

Provides an implementation of NotificationEmitter sample code for javax.management.NotificationEmitter definition code for javax.management.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 sendNotification sample code for javax.management.NotificationBroadcasterSupport.sendNotification(javax.management.Notification) definition code for javax.management.NotificationBroadcasterSupport.sendNotification(javax.management.Notification) , the NotificationListener.handleNotification sample code for javax.management.NotificationListener.handleNotification(javax.management.Notification, java.lang.Object) definition code for javax.management.NotificationListener.handleNotification(javax.management.Notification, java.lang.Object) 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:

Since:
1.5

Constructor Summary
NotificationBroadcasterSupport sample code for javax.management.NotificationBroadcasterSupport.NotificationBroadcasterSupport() definition code for javax.management.NotificationBroadcasterSupport.NotificationBroadcasterSupport() ()
           
 
Method Summary
 void addNotificationListener sample code for javax.management.NotificationBroadcasterSupport.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) definition code for javax.management.NotificationBroadcasterSupport.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) (NotificationListener sample code for javax.management.NotificationListener definition code for javax.management.NotificationListener  listener, NotificationFilter sample code for javax.management.NotificationFilter definition code for javax.management.NotificationFilter  filter, Object sample code for java.lang.Object definition code for java.lang.Object  handback)
          Adds a listener.
 MBeanNotificationInfo sample code for javax.management.MBeanNotificationInfo definition code for javax.management.MBeanNotificationInfo [] getNotificationInfo sample code for javax.management.NotificationBroadcasterSupport.getNotificationInfo() definition code for javax.management.NotificationBroadcasterSupport.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 sample code for javax.management.NotificationBroadcasterSupport.handleNotification(javax.management.NotificationListener, javax.management.Notification, java.lang.Object) definition code for javax.management.NotificationBroadcasterSupport.handleNotification(javax.management.NotificationListener, javax.management.Notification, java.lang.Object) (NotificationListener sample code for javax.management.NotificationListener definition code for javax.management.NotificationListener  listener, Notification sample code for javax.management.Notification definition code for javax.management.Notification  notif, Object sample code for java.lang.Object definition code for java.lang.Object  handback)
          This method is called by sendNotification sample code for javax.management.NotificationBroadcasterSupport.sendNotification(javax.management.Notification) definition code for javax.management.NotificationBroadcasterSupport.sendNotification(javax.management.Notification) for each listener in order to send the notification to that listener.
 void removeNotificationListener sample code for javax.management.NotificationBroadcasterSupport.removeNotificationListener(javax.management.NotificationListener) definition code for javax.management.NotificationBroadcasterSupport.removeNotificationListener(javax.management.NotificationListener) (NotificationListener sample code for javax.management.NotificationListener definition code for javax.management.NotificationListener  listener)
          Removes a listener from this MBean.
 void removeNotificationListener sample code for javax.management.NotificationBroadcasterSupport.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) definition code for javax.management.NotificationBroadcasterSupport.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) (NotificationListener sample code for javax.management.NotificationListener definition code for javax.management.NotificationListener  listener, NotificationFilter sample code for javax.management.NotificationFilter definition code for javax.management.NotificationFilter  filter, Object sample code for java.lang.Object definition code for java.lang.Object  handback)
          Removes a listener from this MBean.
 void sendNotification sample code for javax.management.NotificationBroadcasterSupport.sendNotification(javax.management.Notification) definition code for javax.management.NotificationBroadcasterSupport.sendNotification(javax.management.Notification) (Notification sample code for javax.management.Notification definition code for javax.management.Notification  notification)
          Sends a notification.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

NotificationBroadcasterSupport sample code for javax.management.NotificationBroadcasterSupport() definition code for javax.management.NotificationBroadcasterSupport()

public NotificationBroadcasterSupport()
Method Detail

addNotificationListener sample code for javax.management.NotificationBroadcasterSupport.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) definition code for javax.management.NotificationBroadcasterSupport.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)

public void addNotificationListener(NotificationListener sample code for javax.management.NotificationListener definition code for javax.management.NotificationListener  listener,
                                    NotificationFilter sample code for javax.management.NotificationFilter definition code for javax.management.NotificationFilter  filter,
                                    Object sample code for java.lang.Object definition code for java.lang.Object  handback)
Adds a listener.

Specified by:
addNotificationListener sample code for javax.management.NotificationBroadcaster.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) definition code for javax.management.NotificationBroadcaster.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) in interface NotificationBroadcaster sample code for javax.management.NotificationBroadcaster definition code for javax.management.NotificationBroadcaster
Parameters:
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.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - thrown if the listener is null.
See Also:
removeNotificationListener(javax.management.NotificationListener) sample code for javax.management.NotificationBroadcasterSupport.removeNotificationListener(javax.management.NotificationListener) definition code for javax.management.NotificationBroadcasterSupport.removeNotificationListener(javax.management.NotificationListener)

removeNotificationListener sample code for javax.management.NotificationBroadcasterSupport.removeNotificationListener(javax.management.NotificationListener) definition code for javax.management.NotificationBroadcasterSupport.removeNotificationListener(javax.management.NotificationListener)

public void removeNotificationListener(NotificationListener sample code for javax.management.NotificationListener definition code for javax.management.NotificationListener  listener)
                                throws ListenerNotFoundException sample code for javax.management.ListenerNotFoundException definition code for javax.management.ListenerNotFoundException 
Description copied from interface: NotificationBroadcaster sample code for javax.management.NotificationBroadcaster.removeNotificationListener(javax.management.NotificationListener) definition code for javax.management.NotificationBroadcaster.removeNotificationListener(javax.management.NotificationListener)
Removes a listener from this MBean. If the listener has been registered with different handback objects or notification filters, all entries corresponding to the listener will be removed.

Specified by:
removeNotificationListener sample code for javax.management.NotificationBroadcaster.removeNotificationListener(javax.management.NotificationListener) definition code for javax.management.NotificationBroadcaster.removeNotificationListener(javax.management.NotificationListener) in interface NotificationBroadcaster sample code for javax.management.NotificationBroadcaster definition code for javax.management.NotificationBroadcaster
Parameters:
listener - A listener that was previously added to this MBean.
Throws:
ListenerNotFoundException sample code for javax.management.ListenerNotFoundException definition code for javax.management.ListenerNotFoundException - The listener is not registered with the MBean.
See Also:
NotificationBroadcaster.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) sample code for javax.management.NotificationBroadcaster.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) definition code for javax.management.NotificationBroadcaster.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) , NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) sample code for javax.management.NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) definition code for javax.management.NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)

removeNotificationListener sample code for javax.management.NotificationBroadcasterSupport.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) definition code for javax.management.NotificationBroadcasterSupport.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)

public void removeNotificationListener(NotificationListener sample code for javax.management.NotificationListener definition code for javax.management.NotificationListener  listener,
                                       NotificationFilter sample code for javax.management.NotificationFilter definition code for javax.management.NotificationFilter  filter,
                                       Object sample code for java.lang.Object definition code for java.lang.Object  handback)
                                throws ListenerNotFoundException sample code for javax.management.ListenerNotFoundException definition code for javax.management.ListenerNotFoundException 
Description copied from interface: NotificationEmitter sample code for javax.management.NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) definition code for javax.management.NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)

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.

Specified by:
removeNotificationListener sample code for javax.management.NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) definition code for javax.management.NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) in interface NotificationEmitter sample code for javax.management.NotificationEmitter definition code for javax.management.NotificationEmitter
Parameters:
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.
Throws:
ListenerNotFoundException sample code for javax.management.ListenerNotFoundException definition code for javax.management.ListenerNotFoundException - The listener is not registered with the MBean, or it is not registered with the given filter and handback.

getNotificationInfo sample code for javax.management.NotificationBroadcasterSupport.getNotificationInfo() definition code for javax.management.NotificationBroadcasterSupport.getNotificationInfo()

public MBeanNotificationInfo sample code for javax.management.MBeanNotificationInfo definition code for javax.management.MBeanNotificationInfo [] getNotificationInfo()
Description copied from interface: NotificationBroadcaster sample code for javax.management.NotificationBroadcaster.getNotificationInfo() definition code for javax.management.NotificationBroadcaster.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.

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.

Specified by:
getNotificationInfo sample code for javax.management.NotificationBroadcaster.getNotificationInfo() definition code for javax.management.NotificationBroadcaster.getNotificationInfo() in interface NotificationBroadcaster sample code for javax.management.NotificationBroadcaster definition code for javax.management.NotificationBroadcaster
Returns:
the array of possible notifications.

sendNotification sample code for javax.management.NotificationBroadcasterSupport.sendNotification(javax.management.Notification) definition code for javax.management.NotificationBroadcasterSupport.sendNotification(javax.management.Notification)

public void sendNotification(Notification sample code for javax.management.Notification definition code for javax.management.Notification  notification)
Sends a notification.

Parameters:
notification - The notification to send.

handleNotification sample code for javax.management.NotificationBroadcasterSupport.handleNotification(javax.management.NotificationListener, javax.management.Notification, java.lang.Object) definition code for javax.management.NotificationBroadcasterSupport.handleNotification(javax.management.NotificationListener, javax.management.Notification, java.lang.Object)

protected void handleNotification(NotificationListener sample code for javax.management.NotificationListener definition code for javax.management.NotificationListener  listener,
                                  Notification sample code for javax.management.Notification definition code for javax.management.Notification  notif,
                                  Object sample code for java.lang.Object definition code for java.lang.Object  handback)

This method is called by sendNotification sample code for javax.management.NotificationBroadcasterSupport.sendNotification(javax.management.Notification) definition code for javax.management.NotificationBroadcasterSupport.sendNotification(javax.management.Notification) 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 sample code for javax.management.NotificationBroadcasterSupport.sendNotification(javax.management.Notification) definition code for javax.management.NotificationBroadcasterSupport.sendNotification(javax.management.Notification) .

The default implementation of this method is equivalent to

 listener.handleNotification(notif, handback);
 

Parameters:
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.