Top Description Fields Constructors Methods
org.springframework.jmx.export.notification

public Class ModelMBeanNotificationPublisher

extends Object
implements NotificationPublisher
Class Inheritance
All Implemented Interfaces
org.springframework.jmx.export.notification.NotificationPublisher
Imports
javax.management.AttributeChangeNotification, .MBeanException, .Notification, .ObjectName, javax.management.modelmbean.ModelMBean, .ModelMBeanNotificationBroadcaster, org.springframework.util.Assert

NotificationPublisher implementation that uses the infrastructure provided by the ModelMBean interface to track javax.management.NotificationListeners and send Notifications to those listeners.
Authors
Rob Harrop, Juergen Hoeller, Rick Evans
Since
2.0
See Also
javax.management.modelmbean.ModelMBeanNotificationBroadcaster, NotificationPublisherAware

Field Summary

Modifier and TypeField and Description
private final Object
managedResource

The managed resource associated with the modelMBean.

private final ModelMBeanNotificationBroadcaster
modelMBean

The ModelMBean instance wrapping the managed resource into which this NotificationPublisher will be injected.

private final ObjectName
objectName

The ObjectName associated with the modelMBean.

Constructor Summary

AccessConstructor and Description
public
ModelMBeanNotificationPublisher(ModelMBeanNotificationBroadcaster
the target ModelMBean; must not be null
modelMBean
,
ObjectName
the ObjectName of the source ModelMBean
objectName
,
Object
the managed resource exposed by the supplied ModelMBean
managedResource
)

Create a new instance of the ModelMBeanNotificationPublisher class that will publish all Notifications to the supplied ModelMBean.

Method Summary

Modifier and TypeMethod and Description
private void
replaceNotificationSourceIfNecessary(Notification notification)

Replaces the notification source if necessary to do so.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

managedResourceback to summary
private final Object managedResource

The managed resource associated with the modelMBean.

modelMBeanback to summary
private final ModelMBeanNotificationBroadcaster modelMBean

The ModelMBean instance wrapping the managed resource into which this NotificationPublisher will be injected.

objectNameback to summary
private final ObjectName objectName

The ObjectName associated with the modelMBean.

Constructor Detail

ModelMBeanNotificationPublisherback to summary
public ModelMBeanNotificationPublisher(ModelMBeanNotificationBroadcaster modelMBean, ObjectName objectName, Object managedResource)

Create a new instance of the ModelMBeanNotificationPublisher class that will publish all Notifications to the supplied ModelMBean.

Parameters
modelMBean:ModelMBeanNotificationBroadcaster

the target ModelMBean; must not be null

objectName:ObjectName

the ObjectName of the source ModelMBean

managedResource:Object

the managed resource exposed by the supplied ModelMBean

Exceptions
IllegalArgumentException:
if any of the parameters is null

Method Detail

replaceNotificationSourceIfNecessaryback to summary
private void replaceNotificationSourceIfNecessary(Notification notification)

Replaces the notification source if necessary to do so. From the javadoc: "It is strongly recommended that notification senders use the object name rather than a reference to the MBean object as the source."

Parameters
notification:Notification

the Notification whose javax.management.Notification#getSource() might need massaging

sendNotificationback to summary
public void sendNotification(Notification notification)

Implements org.springframework.jmx.export.notification.NotificationPublisher.sendNotification.

Send the supplied Notification using the wrapped ModelMBean instance.

Parameters
notification:Notification

the Notification to be sent

Annotations
@Override
Exceptions
IllegalArgumentException:
if the supplied notification is null
UnableToSendNotificationException:
if the supplied notification could not be sent