Provides an implementation of NotificationEmitter
interface. This can be used as the super class of an MBean that
sends notifications.
By default, the notification dispatch model is synchronous.
That is, when a thread calls sendNotification, the
NotificationListener.handleNotification method of each listener
is called within that thread. You can override this default
by overriding handleNotification in a subclass, or by passing an
Executor to the constructor.
If the method call of a filter or listener throws an Exception,
then that exception does not prevent other listeners from being invoked. However,
if the method call of a filter or of Executor.execute or of
handleNotification (when no Executor is specified) throws an
Error, then that Error is propagated to the caller of
sendNotification.
Remote listeners added using the JMX Remote API (see JMXConnector) are not usually called synchronously. That is, when sendNotification returns, it is not guaranteed that any remote listeners have yet received the notification.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final Executor | |
| private final Executor | |
| private List | |
| private static final ClassLogger | |
| private static final MBeanNotificationInfo[] | |
| private final MBeanNotificationInfo[] |
| Access | Constructor and Description |
|---|---|
| public | NotificationBroadcasterSupport()
Constructs a NotificationBroadcasterSupport where each listener is invoked by the thread sending the notification. |
| public | NotificationBroadcasterSupport(Executor
an executor used by the method executor)sendNotification to
send each notification. If it is null, the thread calling sendNotification
will invoke the handleNotification method itself.Constructs a NotificationBroadcasterSupport where each listener is invoked using
the given |
| public | NotificationBroadcasterSupport(MBeanNotificationInfo...
an array indicating, for each notification this
MBean may send, the name of the Java class of the notification
and the notification type. Can be null, which is equivalent to
an empty array. info)Constructs a NotificationBroadcasterSupport with information about the notifications that may be sent. |
| public | NotificationBroadcasterSupport(Executor
an executor used by the method
executor, MBeanNotificationInfo... sendNotification to send each notification. If it
is null, the thread calling sendNotification will
invoke the handleNotification method itself.an array indicating, for each notification this
MBean may send, the name of the Java class of the notification
and the notification type. Can be null, which is equivalent to
an empty array. info)Constructs a NotificationBroadcasterSupport with information about the notifications that may be sent,
and where each listener is invoked using the given |
| Modifier and Type | Method and Description |
|---|---|
| public void | addNotificationListener(NotificationListener
The listener to receive notifications. listener, NotificationFilter The filter object. If filter is null, no
filtering will be performed before handling notifications. filter, Object 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. handback)Implements javax. Adds a listener. |
| public MBeanNotificationInfo[] | getNotificationInfo()
Implements javax. 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
the listener to which the notification is being
delivered. listener, Notification the notification being delivered to the listener. notif, Object the handback object that was supplied when the
listener was added. handback)This method is called by |
| public void | removeNotificationListener(NotificationListener listener)
Implements javax. Removes a listener from this MBean. |
| public void | removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
Implements javax. Removes a listener from this MBean. |
| public void |
| defaultExecutor | back to summary |
|---|---|
| private static final Executor defaultExecutor | |
| executor | back to summary |
|---|---|
| private final Executor executor | |
| listenerList | back to summary |
|---|---|
| private List<NotificationBroadcasterSupport. | |
| logger | back to summary |
|---|---|
| private static final ClassLogger logger | |
| NO_NOTIFICATION_INFO | back to summary |
|---|---|
| private static final MBeanNotificationInfo[] NO_NOTIFICATION_INFO | |
| notifInfo | back to summary |
|---|---|
| private final MBeanNotificationInfo[] notifInfo | |
| NotificationBroadcasterSupport | back to summary |
|---|---|
| public NotificationBroadcasterSupport() Constructs a NotificationBroadcasterSupport where each listener is invoked by the
thread sending the notification. This constructor is equivalent to
| |
| NotificationBroadcasterSupport | back to summary |
|---|---|
| public NotificationBroadcasterSupport(Executor executor) Constructs a NotificationBroadcasterSupport where each listener is invoked using
the given
| |
| NotificationBroadcasterSupport | back to summary |
|---|---|
| public NotificationBroadcasterSupport(MBeanNotificationInfo... info) Constructs a NotificationBroadcasterSupport with information
about the notifications that may be sent. Each listener is
invoked by the thread sending the notification. This
constructor is equivalent to If the
| |
| NotificationBroadcasterSupport | back to summary |
|---|---|
| public NotificationBroadcasterSupport(Executor executor, MBeanNotificationInfo... info) Constructs a NotificationBroadcasterSupport with information about the notifications that may be sent,
and where each listener is invoked using the given When If the
| |
| addNotificationListener | back to summary |
|---|---|
| public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) Implements javax. Adds a listener.
| |
| getNotificationInfo | back to summary |
|---|---|
| public MBeanNotificationInfo[] getNotificationInfo() Implements javax. Doc from javax. 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. | |
| handleNotification | back to summary |
|---|---|
| protected void handleNotification(NotificationListener listener, Notification notif, Object handback) This method is called by The default implementation of this method is equivalent to listener.handleNotification(notif, handback);
| |
| removeNotificationListener | back to summary |
|---|---|
| public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException Implements javax. Doc from javax. 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.
| |
| removeNotificationListener | back to summary |
|---|---|
| public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException Implements javax. Doc from javax. Removes a listener from this MBean. The MBean must have a
listener that exactly matches the given The
| |
| sendNotification | back to summary |
|---|---|
| public void sendNotification(Notification notification) Sends a notification.
If an
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv NotificationFilter | |
| pack-priv Object | |
| pack-priv NotificationListener |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object o)
Overrides java. Indicates whether some other object is "equal to" this one. |
| public int |
| filter | back to summary |
|---|---|
| pack-priv NotificationFilter filter | |
| handback | back to summary |
|---|---|
| pack-priv Object handback | |
| listener | back to summary |
|---|---|
| pack-priv NotificationListener listener | |
| ListenerInfo | back to summary |
|---|---|
| pack-priv ListenerInfo(NotificationListener listener, NotificationFilter filter, Object handback) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| Modifier and Type | Field and Description |
|---|---|
| private final NotificationBroadcasterSupport. | |
| private final Notification |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| listenerInfo | back to summary |
|---|---|
| private final NotificationBroadcasterSupport. | |
| notif | back to summary |
|---|---|
| private final Notification notif | |
| SendNotifJob | back to summary |
|---|---|
| public SendNotifJob(Notification notif, NotificationBroadcasterSupport. | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation. | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object o)
Overrides javax. Indicates whether some other object is "equal to" this one. |
| public int | hashCode()
Overrides javax. Returns a hash code value for this object. |
| WildcardListenerInfo | back to summary |
|---|---|
| pack-priv WildcardListenerInfo(NotificationListener listener) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides javax. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides javax. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |