- java.lang.Object
-
- javax.management.StandardMBean
-
- javax.management.StandardEmitterMBean
-
public class StandardEmitterMBean extends StandardMBean implements NotificationEmitter
一个MBean,其管理接口由Java接口上的反射确定,并发出通知。
以下示例显示如何使用公共构造函数
StandardEmitterMBean(implementation, mbeanInterface, emitter)创建一个MBean,其发出具有任何实现类名称Impl的通知,其中任何接口Intf定义了管理接口(对于当前的标准MBean),并且具有接口NotificationEmitter的任何实现。 该示例使用类NotificationBroadcasterSupport作为接口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);- 从以下版本开始:
- 1.6
- 另请参见:
-
StandardMBean
-
-
构造方法摘要
构造方法 变量 构造器 描述 protectedStandardEmitterMBean(类<?> mbeanInterface, boolean isMXBean, NotificationEmitter emitter)创建一个MBean,其管理接口由mbeanInterface指定,并且通知由给定的NotificationEmitter处理。protectedStandardEmitterMBean(类<?> mbeanInterface, NotificationEmitter emitter)创建一个MBean,其管理接口由mbeanInterface指定,并且通知由给定的NotificationEmitter处理。StandardEmitterMBean(T implementation, 类<T> mbeanInterface, boolean isMXBean, NotificationEmitter emitter)创建一个MBean,其管理接口由mbeanInterface指定,具有给定的实现,并且给定的通知由给定的NotificationEmitter处理。StandardEmitterMBean(T implementation, 类<T> mbeanInterface, NotificationEmitter emitter)创建一个MBean,其管理接口由mbeanInterface指定,具有给定的实现,并且给定的通知由给定的NotificationEmitter处理。
-
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 voidsendNotification(Notification n)发送通知。-
声明方法的类 javax.management.StandardMBean
cacheMBeanInfo, getCachedMBeanInfo, getClassName, getConstructors, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getImpact, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, getParameterName, getParameterName, postDeregister, postRegister, preDeregister, preRegister, setImplementation
-
声明方法的类 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
声明方法的接口 javax.management.DynamicMBean
getAttribute, getAttributes, invoke, setAttribute, setAttributes
-
声明方法的接口 javax.management.NotificationBroadcaster
addNotificationListener, getNotificationInfo, removeNotificationListener
-
声明方法的接口 javax.management.NotificationEmitter
removeNotificationListener
-
-
-
-
构造方法详细信息
-
StandardEmitterMBean
public StandardEmitterMBean(T implementation, 类<T> mbeanInterface, NotificationEmitter emitter)创建一个MBean,其管理接口由
mbeanInterface指定,具有给定的实现,并且给定的通知由给定的NotificationEmitter处理。 生成的MBean通过将其方法转发到emitter来实现NotificationEmitter接口。implementation和emitter是同一个对象是合法且有用的。如果
emitter是实例NotificationBroadcasterSupport则MBean的sendNotification方法将调用emitter.sendNotification。通过返回的数组
NotificationBroadcaster.getNotificationInfo()在新的MBean是返回数组的副本emitter.getNotificationInfo()在施工时间。 如果emitter.getNotificationInfo()返回的数组稍后更改,则对该对象的getNotificationInfo()没有影响。- 参数类型
-
T- MBean的实现类型 - 参数
-
implementation- MBean接口的实现。 -
mbeanInterface- 标准MBean接口。 -
emitter- 将处理通知的对象。 - 异常
-
IllegalArgumentException- 如果mbeanInterface未遵循管理接口的JMX设计模式,或者给定的implementation未实现指定的接口,或者emitter为空。
-
StandardEmitterMBean
public StandardEmitterMBean(T implementation, 类<T> mbeanInterface, boolean isMXBean, NotificationEmitter emitter)创建一个管理接口由
mbeanInterface指定的mbeanInterface,具有给定的实现,并由给定的NotificationEmitter处理通知。 此构造函数可用于制作标准MBean或MXBeans。 生成的MBean通过将其方法转发到emitter来实现NotificationEmitter接口。implementation和emitter是同一个对象是合法且有用的。如果
emitter是实例NotificationBroadcasterSupport则MBean的sendNotification方法将调用emitter.sendNotification。通过返回的数组
NotificationBroadcaster.getNotificationInfo()在新的MBean是返回数组的副本emitter.getNotificationInfo()在施工时间。 如果emitter.getNotificationInfo()返回的数组稍后更改,则对该对象的getNotificationInfo()没有影响。- 参数类型
-
T- MBean的实现类型 - 参数
-
implementation- MBean接口的实现。 -
mbeanInterface- 标准MBean接口。 -
isMXBean- 如果为true,则mbeanInterface参数指定MXBean接口,结果MBean为MXBean。 -
emitter- 将处理通知的对象。 - 异常
-
IllegalArgumentException- 如果mbeanInterface不遵循管理接口的JMX设计模式,或者给定的implementation未实现指定的接口,或者emitter为空。
-
StandardEmitterMBean
protected StandardEmitterMBean(类<?> mbeanInterface, NotificationEmitter emitter)
创建一个MBean,其管理接口由
mbeanInterface指定,并且通知由给定的NotificationEmitter处理。 生成的MBean通过将其方法转发到emitter来实现NotificationEmitter接口。如果
emitter是实例NotificationBroadcasterSupport则MBean的sendNotification方法将调用emitter.sendNotification。通过返回的数组
NotificationBroadcaster.getNotificationInfo()在新的MBean是返回数组的副本emitter.getNotificationInfo()在施工时间。 如果emitter.getNotificationInfo()返回的数组稍后更改,则对此对象的getNotificationInfo()没有影响。必须从实现给定
mbeanInterface的子类调用此构造函数。- 参数
-
mbeanInterface- StandardMBean接口。 -
emitter- 将处理通知的对象。 - 异常
-
IllegalArgumentException- 如果mbeanInterface未遵循管理接口的JMX设计模式,或者this未实现指定的接口,或者emitter为空。
-
StandardEmitterMBean
protected StandardEmitterMBean(类<?> mbeanInterface, boolean isMXBean, NotificationEmitter emitter)
创建一个MBean,其管理接口由
mbeanInterface指定,并且通知由给定的NotificationEmitter处理。 此构造函数可用于制作标准MBean或MXBeans。 生成的MBean通过将其方法转发到emitter来实现NotificationEmitter接口。如果
emitter是实例NotificationBroadcasterSupport则MBean的sendNotification方法将调用emitter.sendNotification。通过返回的数组
NotificationBroadcaster.getNotificationInfo()在新的MBean是返回数组的副本emitter.getNotificationInfo()在施工时间。 如果emitter.getNotificationInfo()返回的数组稍后更改,则对该对象的getNotificationInfo()没有影响。必须从实现给定
mbeanInterface的子类调用此构造函数。- 参数
-
mbeanInterface- StandardMBean接口。 -
isMXBean- 如果为true,则mbeanInterface参数命名为MXBean接口,结果MBean为MXBean。 -
emitter- 将处理通知的对象。 - 异常
-
IllegalArgumentException- 如果mbeanInterface未遵循管理接口的JMX设计模式,或者this未实现指定的接口,或者emitter为空。
-
-
方法详细信息
-
sendNotification
public void sendNotification(Notification n)
发送通知。
如果构造函数的
emitter参数是NotificationBroadcasterSupport的实例,则此方法将调用emitter.sendNotification。- 参数
-
n- 要发送的通知。 - 异常
-
ClassCastException- 如果构造函数的emitter参数不是NotificationBroadcasterSupport。
-
-