Package org.springframework.jmx.support
Class NotificationListenerHolder
- java.lang.Object
- org.springframework.jmx.support.NotificationListenerHolder
- Direct Known Subclasses:
NotificationListenerBean
,NotificationListenerRegistrar
public class NotificationListenerHolder extends Object
Helper class that aggregates aNotificationListener
, aNotificationFilter
, and an arbitrary handback object, as well as the names of MBeans from which the listener wishes to receiveNotifications
.- Since:
- 2.5.2
- Author:
- Juergen Hoeller
- See Also:
NotificationListenerBean
,NotificationListenerRegistrar
Field Summary
Fields Modifier and Type Field Description protected Set<Object>
mappedObjectNames
Constructor Summary
Constructors Constructor Description NotificationListenerHolder()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
Object
getHandback()
Return the (arbitrary) object that will be 'handed back' as-is by anNotificationBroadcaster
when notifying anyNotificationListener
.NotificationFilter
getNotificationFilter()
Return theNotificationFilter
associated with the encapsulatedNotificationListener
.NotificationListener
getNotificationListener()
Get theNotificationListener
.ObjectName[]
getResolvedObjectNames()
Return the list ofObjectName
String representations for which the encapsulatedNotificationFilter
will be registered as a listener forNotifications
.int
hashCode()
void
setHandback(Object handback)
Set the (arbitrary) object that will be 'handed back' as-is by anNotificationBroadcaster
when notifying anyNotificationListener
.void
setMappedObjectName(Object mappedObjectName)
Set theObjectName
-style name of the single MBean that the encapsulatedNotificationFilter
will be registered with to listen forNotifications
.void
setMappedObjectNames(Object... mappedObjectNames)
Set an array ofObjectName
-style names of the MBeans that the encapsulatedNotificationFilter
will be registered with to listen forNotifications
.void
setNotificationFilter(NotificationFilter notificationFilter)
Set theNotificationFilter
associated with the encapsulatedNotificationFilter
.void
setNotificationListener(NotificationListener notificationListener)
Set theNotificationListener
.
Field Detail
mappedObjectNames
@Nullable protected Set<Object> mappedObjectNames
Constructor Detail
NotificationListenerHolder
public NotificationListenerHolder()
Method Detail
setNotificationListener
public void setNotificationListener(@Nullable NotificationListener notificationListener)
Set theNotificationListener
.
getNotificationListener
@Nullable public NotificationListener getNotificationListener()
Get theNotificationListener
.
setNotificationFilter
public void setNotificationFilter(@Nullable NotificationFilter notificationFilter)
getNotificationFilter
@Nullable public NotificationFilter getNotificationFilter()
setHandback
public void setHandback(@Nullable Object handback)
Set the (arbitrary) object that will be 'handed back' as-is by anNotificationBroadcaster
when notifying anyNotificationListener
.- Parameters:
handback
- the handback object (can benull
)- See Also:
NotificationListener.handleNotification(javax.management.Notification, Object)
getHandback
@Nullable public Object getHandback()
Return the (arbitrary) object that will be 'handed back' as-is by anNotificationBroadcaster
when notifying anyNotificationListener
.- Returns:
- the handback object (may be
null
) - See Also:
NotificationListener.handleNotification(javax.management.Notification, Object)
setMappedObjectName
public void setMappedObjectName(@Nullable Object mappedObjectName)
Set theObjectName
-style name of the single MBean that the encapsulatedNotificationFilter
will be registered with to listen forNotifications
. Can be specified asObjectName
instance or asString
.
setMappedObjectNames
public void setMappedObjectNames(Object... mappedObjectNames)
Set an array ofObjectName
-style names of the MBeans that the encapsulatedNotificationFilter
will be registered with to listen forNotifications
. Can be specified asObjectName
instances or asString
s.
getResolvedObjectNames
@Nullable public ObjectName[] getResolvedObjectNames() throws MalformedObjectNameException
Return the list ofObjectName
String representations for which the encapsulatedNotificationFilter
will be registered as a listener forNotifications
.- Throws:
MalformedObjectNameException
- if anObjectName
is malformed