Class BaseNotificationBroadcaster
java.lang.Object
org.apache.tomcat.util.modeler.BaseNotificationBroadcaster
- All Implemented Interfaces:
NotificationBroadcaster
Implementation of
NotificationBroadcaster for attribute change notifications. This class is used by
BaseModelMBean to handle notifications of attribute change events to interested listeners.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) Add a notification event listener to this MBean.Return anMBeanNotificationInfoobject describing the notifications sent by this MBean.voidremoveAttributeNotificationListener(NotificationListener listener, String name) Remove an attribute change notification event listener for a specific attribute name from this MBean, or all attribute change registrations for the listener if the name isnull.voidRemove a notification event listener from this MBean.voidsendNotification(Notification notification) Send the specified notification to all interested listeners.
-
Constructor Details
-
BaseNotificationBroadcaster
public BaseNotificationBroadcaster()Default constructor.
-
-
Method Details
-
addNotificationListener
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException Add a notification event listener to this MBean.- Specified by:
addNotificationListenerin interfaceNotificationBroadcaster- Parameters:
listener- Listener that will receive event notificationsfilter- Filter object used to filter event notifications actually delivered, ornullfor no filteringhandback- object to be sent along with event notifications- Throws:
IllegalArgumentException- if the listener parameter is null
-
getNotificationInfo
Return anMBeanNotificationInfoobject describing the notifications sent by this MBean.- Specified by:
getNotificationInfoin interfaceNotificationBroadcaster
-
removeNotificationListener
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException Remove a notification event listener from this MBean.- Specified by:
removeNotificationListenerin interfaceNotificationBroadcaster- Parameters:
listener- The listener to be removed (any and all registrations for this listener will be eliminated)- Throws:
ListenerNotFoundException- if this listener is not registered in the MBean
-
removeAttributeNotificationListener
Remove an attribute change notification event listener for a specific attribute name from this MBean, or all attribute change registrations for the listener if the name isnull. For a specific name, other registrations of the same listener are left untouched. If a coalesced filter ends up accepting no explicit names, the corresponding entry is removed entirely rather than being turned into an accept-all filter. A registration that accepts all attribute names (a filter with no explicit names, created when the listener was added with anullattribute name) can only be removed by passing anullname here.- Parameters:
listener- The listener to be removedname- The attribute name for which the registration should be removed, ornullto remove all attribute change registrations for the listener
-
sendNotification
Send the specified notification to all interested listeners.- Parameters:
notification- The notification to be sent
-