javax.management

Class StandardEmitterMBean

  • All Implemented Interfaces:
    DynamicMBean, MBeanRegistration, NotificationBroadcaster, NotificationEmitter

    public class StandardEmitterMBean
    extends StandardMBean
    implements NotificationEmitter

    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);
         
    Since:
    1.6
    See Also:
    StandardMBean
    • Constructor Detail

      • StandardEmitterMBean

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

        Make an MBean whose management interface is specified by mbeanInterface, with the given implementation and where notifications are handled by the given NotificationEmitter. The resultant MBean implements the NotificationEmitter interface by forwarding its methods to emitter. It is legal and useful for implementation and emitter to be the same object.

        If emitter is an instance of NotificationBroadcasterSupport then the MBean's sendNotification method will call emitter.sendNotification.

        The array returned by getNotificationInfo() on the new MBean is a copy of the array returned by emitter.getNotificationInfo() at the time of construction. If the array returned by emitter.getNotificationInfo() later changes, that will have no effect on this object's getNotificationInfo().

        Parameters:
        implementation - the implementation of the MBean interface.
        mbeanInterface - a Standard MBean interface.
        emitter - the object that will handle notifications.
        Throws:
        IllegalArgumentException - if the mbeanInterface does not follow JMX design patterns for Management Interfaces, or if the given implementation does not implement the specified interface, or if emitter is null.
      • StandardEmitterMBean

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

        Make an MBean whose management interface is specified by mbeanInterface, with the given implementation and where notifications are handled by the given NotificationEmitter. This constructor can be used to make either Standard MBeans or MXBeans. The resultant MBean implements the NotificationEmitter interface by forwarding its methods to emitter. It is legal and useful for implementation and emitter to be the same object.

        If emitter is an instance of NotificationBroadcasterSupport then the MBean's sendNotification method will call emitter.sendNotification.

        The array returned by getNotificationInfo() on the new MBean is a copy of the array returned by emitter.getNotificationInfo() at the time of construction. If the array returned by emitter.getNotificationInfo() later changes, that will have no effect on this object's getNotificationInfo().

        Parameters:
        implementation - the implementation of the MBean interface.
        mbeanInterface - a Standard MBean interface.
        isMXBean - If true, the mbeanInterface parameter names an MXBean interface and the resultant MBean is an MXBean.
        emitter - the object that will handle notifications.
        Throws:
        IllegalArgumentException - if the mbeanInterface does not follow JMX design patterns for Management Interfaces, or if the given implementation does not implement the specified interface, or if emitter is null.
      • StandardEmitterMBean

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

        Make an MBean whose management interface is specified by mbeanInterface, and where notifications are handled by the given NotificationEmitter. The resultant MBean implements the NotificationEmitter interface by forwarding its methods to emitter.

        If emitter is an instance of NotificationBroadcasterSupport then the MBean's sendNotification method will call emitter.sendNotification.

        The array returned by getNotificationInfo() on the new MBean is a copy of the array returned by emitter.getNotificationInfo() at the time of construction. If the array returned by emitter.getNotificationInfo() later changes, that will have no effect on this object's getNotificationInfo().

        This constructor must be called from a subclass that implements the given mbeanInterface.

        Parameters:
        mbeanInterface - a StandardMBean interface.
        emitter - the object that will handle notifications.
        Throws:
        IllegalArgumentException - if the mbeanInterface does not follow JMX design patterns for Management Interfaces, or if this does not implement the specified interface, or if emitter is null.
      • StandardEmitterMBean

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

        Make an MBean whose management interface is specified by mbeanInterface, and where notifications are handled by the given NotificationEmitter. This constructor can be used to make either Standard MBeans or MXBeans. The resultant MBean implements the NotificationEmitter interface by forwarding its methods to emitter.

        If emitter is an instance of NotificationBroadcasterSupport then the MBean's sendNotification method will call emitter.sendNotification.

        The array returned by getNotificationInfo() on the new MBean is a copy of the array returned by emitter.getNotificationInfo() at the time of construction. If the array returned by emitter.getNotificationInfo() later changes, that will have no effect on this object's getNotificationInfo().

        This constructor must be called from a subclass that implements the given mbeanInterface.

        Parameters:
        mbeanInterface - a StandardMBean interface.
        isMXBean - If true, the mbeanInterface parameter names an MXBean interface and the resultant MBean is an MXBean.
        emitter - the object that will handle notifications.
        Throws:
        IllegalArgumentException - if the mbeanInterface does not follow JMX design patterns for Management Interfaces, or if this does not implement the specified interface, or if emitter is null.

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Document créé le 11/06/2005, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/management/StandardEmitterMBean.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.

Table des matières Haut