An MBean whose management interface is determined by reflection on a Java interface, and that emits notifications.
The following example shows how to use the public constructor
StandardEmitterMBean(implementation, mbeanInterface, emitter) to
create an MBean emitting notifications with any
implementation class name Impl, with a management
interface defined (as for current Standard MBeans) by any interface
Intf, and with any implementation of the interface
NotificationEmitter. The example uses the class
NotificationBroadcasterSupport as an implementation
of the interface NotificationEmitter.
MBeanServer mbs;
...
final String[] types = new String[] {"sun.disc.space","sun.disc.alarm"};
final MBeanNotificationInfo info = new MBeanNotificationInfo(
types,
Notification.class.getName(),
"Notification about disc info.");
final NotificationEmitter emitter =
new NotificationBroadcasterSupport(info);
final Intf impl = new Impl(...);
final Object mbean = new StandardEmitterMBean(
impl, Intf.class, emitter);
mbs.registerMBean(mbean, objectName);
StandardMBean
| Modifier and Type | Field and Description |
|---|---|
| private final NotificationEmitter | |
| private static final MBeanNotificationInfo[] | |
| private final MBeanNotificationInfo[] |
| Access | Constructor and Description |
|---|---|
| public < the implementation type of the MBean T> | StandardEmitterMBean(T
the implementation of the MBean interface. implementation, Class<T> a Standard MBean interface. mbeanInterface, NotificationEmitter the object that will handle notifications. emitter)Make an MBean whose management interface is specified by
|
| public < the implementation type of the MBean T> | StandardEmitterMBean(T
the implementation of the MBean interface. implementation, Class<T> a Standard MBean interface. mbeanInterface, boolean If true, the isMXBean, NotificationEmitter mbeanInterface parameter
names an MXBean interface and the resultant MBean is an MXBean.the object that will handle notifications. emitter)Make an MBean whose management interface is specified by
|
| protected | StandardEmitterMBean(Class<?>
a StandardMBean interface. mbeanInterface, NotificationEmitter the object that will handle notifications. emitter)Make an MBean whose management interface is specified by
|
| protected | StandardEmitterMBean(Class<?>
a StandardMBean interface. mbeanInterface, boolean If true, the isMXBean, NotificationEmitter mbeanInterface parameter
names an MXBean interface and the resultant MBean is an MXBean.the object that will handle notifications. emitter)Make an MBean whose management interface is specified by
|
| Modifier and Type | Method and Description |
|---|---|
| public void | addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
Implements javax. Adds a listener to this MBean. |
| 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. |
| pack-priv MBeanNotificationInfo[] | Returns: the MBeanNotificationInfo[] for the new MBeanInfo.The default MBeanInfo derived by reflection. info)Overrides javax. Get the MBeanNotificationInfo[] that will be used in the MBeanInfo returned by this MBean. |
| 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 |
| emitter | back to summary |
|---|---|
| private final NotificationEmitter emitter | |
| NO_NOTIFICATION_INFO | back to summary |
|---|---|
| private static final MBeanNotificationInfo[] NO_NOTIFICATION_INFO | |
| notificationInfo | back to summary |
|---|---|
| private final MBeanNotificationInfo[] notificationInfo | |
| StandardEmitterMBean | back to summary |
|---|---|
| public <T> StandardEmitterMBean(T implementation, Class<T> mbeanInterface, NotificationEmitter emitter) Make an MBean whose management interface is specified by
If The array returned by
| |
| StandardEmitterMBean | back to summary |
|---|---|
| public <T> StandardEmitterMBean(T implementation, Class<T> mbeanInterface, boolean isMXBean, NotificationEmitter emitter) Make an MBean whose management interface is specified by
If The array returned by
| |
| StandardEmitterMBean | back to summary |
|---|---|
| protected StandardEmitterMBean(Class<?> mbeanInterface, NotificationEmitter emitter) Make an MBean whose management interface is specified by
If The array returned by This constructor must be called from a subclass that implements
the given
| |
| StandardEmitterMBean | back to summary |
|---|---|
| protected StandardEmitterMBean(Class<?> mbeanInterface, boolean isMXBean, NotificationEmitter emitter) Make an MBean whose management interface is specified by
If The array returned by This constructor must be called from a subclass that implements
the given
| |
| addNotificationListener | back to summary |
|---|---|
| public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) Implements javax. Doc from javax. Adds a listener to this MBean. | |
| 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. | |
| getNotifications | back to summary |
|---|---|
| pack-priv MBeanNotificationInfo[] getNotifications(MBeanInfo info) Overrides javax. Get the MBeanNotificationInfo[] that will be used in the MBeanInfo returned by this MBean. The default implementation of this method returns
| |
| 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 n) Sends a notification. If the
| |