类 StandardEmitterMBean

java.lang.Object
javax.management.StandardMBean
javax.management.StandardEmitterMBean
所有已实现的接口:
DynamicMBean , MBeanRegistration , NotificationBroadcaster , NotificationEmitter

public class StandardEmitterMBean extends StandardMBean implements NotificationEmitter

一个 MBean,其管理接口由 Java 接口上的反射决定,并发出通知。

以下示例显示如何使用公共构造函数 StandardEmitterMBean(implementation, mbeanInterface, emitter) 创建一个 MBean 发出具有任何实现类名称的通知实施,具有由任何接口定义的管理接口(对于当前标准 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
参见:
  • 构造方法详细信息

    • StandardEmitterMBean

      public StandardEmitterMBean(T implementation, Class <T> mbeanInterface, NotificationEmitter  emitter)

      创建一个 MBean,其管理接口由 mbeanInterface 指定,具有给定的实现,通知由给定的 NotificationEmitter 处理。生成的 MBean 通过将其方法转发给 emitter 来实现 NotificationEmitter 接口。 implementationemitter 是同一个对象是合法且有用的。

      如果 emitter NotificationBroadcasterSupport 的实例,则 MBean 的 sendNotification 方法将调用 emitter. sendNotification

      getNotificationInfo() 在新 MBean 上返回的数组是构造时 emitter. getNotificationInfo() 返回的数组的副本。如果 emitter.getNotificationInfo() 返回的数组稍后发生变化,则不会影响此对象的 getNotificationInfo()

      类型参数:
      T - MBean 的实现类型
      参数:
      implementation - MBean 接口的实现。
      mbeanInterface - 标准 MBean 接口。
      emitter - 将处理通知的对象。
      抛出:
      IllegalArgumentException - 如果 mbeanInterface 不遵循管理接口的 JMX 设计模式,或者如果给定的 implementation 没有实现指定的接口,或者如果 emitter 为空。
    • StandardEmitterMBean

      public StandardEmitterMBean(T implementation, Class <T> mbeanInterface, boolean isMXBean, NotificationEmitter  emitter)

      创建一个 MBean,其管理接口由 mbeanInterface 指定,具有给定的实现,通知由给定的 NotificationEmitter 处理。此构造函数可用于生成标准 MBean 或 MXBeans。生成的 MBean 通过将其方法转发给 emitter 来实现 NotificationEmitter 接口。 implementationemitter 是同一个对象是合法且有用的。

      如果 emitter NotificationBroadcasterSupport 的实例,则 MBean 的 sendNotification 方法将调用 emitter. sendNotification

      getNotificationInfo() 在新 MBean 上返回的数组是构造时 emitter. getNotificationInfo() 返回的数组的副本。如果 emitter.getNotificationInfo() 返回的数组稍后发生变化,则不会影响此对象的 getNotificationInfo()

      类型参数:
      T - MBean 的实现类型
      参数:
      implementation - MBean 接口的实现。
      mbeanInterface - 标准 MBean 接口。
      isMXBean - 如果为真,mbeanInterface 参数命名一个 MXBean 接口,生成的 MBean 是一个 MXBean。
      emitter - 将处理通知的对象。
      抛出:
      IllegalArgumentException - 如果 mbeanInterface 不遵循管理接口的 JMX 设计模式,或者如果给定的 implementation 没有实现指定的接口,或者如果 emitter 为空。
    • StandardEmitterMBean

      protected StandardEmitterMBean(Class <?> mbeanInterface, NotificationEmitter  emitter)

      创建一个 MBean,其管理接口由 mbeanInterface 指定,通知由给定的 NotificationEmitter 处理。生成的 MBean 通过将其方法转发给 emitter 来实现 NotificationEmitter 接口。

      如果 emitter NotificationBroadcasterSupport 的实例,则 MBean 的 sendNotification 方法将调用 emitter. sendNotification

      getNotificationInfo() 在新 MBean 上返回的数组是构造时 emitter. getNotificationInfo() 返回的数组的副本。如果 emitter.getNotificationInfo() 返回的数组稍后发生变化,则不会影响此对象的 getNotificationInfo()

      必须从实现给定 mbeanInterface 的子类调用此构造函数。

      参数:
      mbeanInterface - 一个 StandardMBean 接口。
      emitter - 将处理通知的对象。
      抛出:
      IllegalArgumentException - 如果 mbeanInterface 不遵循管理接口的 JMX 设计模式,或者如果 this 没有实现指定的接口,或者如果 emitter 为空。
    • StandardEmitterMBean

      protected StandardEmitterMBean(Class <?> mbeanInterface, boolean isMXBean, NotificationEmitter  emitter)

      创建一个 MBean,其管理接口由 mbeanInterface 指定,通知由给定的 NotificationEmitter 处理。此构造函数可用于生成标准 MBean 或 MXBeans。生成的 MBean 通过将其方法转发给 emitter 来实现 NotificationEmitter 接口。

      如果 emitter NotificationBroadcasterSupport 的实例,则 MBean 的 sendNotification 方法将调用 emitter. sendNotification

      getNotificationInfo() 在新 MBean 上返回的数组是构造时 emitter. getNotificationInfo() 返回的数组的副本。如果 emitter.getNotificationInfo() 返回的数组稍后发生变化,则不会影响此对象的 getNotificationInfo()

      必须从实现给定 mbeanInterface 的子类调用此构造函数。

      参数:
      mbeanInterface - 一个 StandardMBean 接口。
      isMXBean - 如果为真,mbeanInterface 参数命名一个 MXBean 接口,生成的 MBean 是一个 MXBean。
      emitter - 将处理通知的对象。
      抛出:
      IllegalArgumentException - 如果 mbeanInterface 不遵循管理接口的 JMX 设计模式,或者如果 this 没有实现指定的接口,或者如果 emitter 为空。
  • 方法详情