モジュール java.management

インタフェースModelMBeanNotificationBroadcaster

  • すべてのスーパー・インタフェース:
    NotificationBroadcaster
    既知のすべてのサブインタフェース:
    ModelMBean
    既知のすべての実装クラス:
    RequiredModelMBean

    public interface ModelMBeanNotificationBroadcaster
    extends NotificationBroadcaster
    このインタフェースはModelMBeanによって実装される必要があります。 このインタフェースの実装は、すべてのJMXエージェントに付属しています。

    管理対象になるJavaリソースは、MBeanServerのcreateMBeanメソッドを使って、ModelMBeanをインスタンス化します。 次に、ModelMBeanインスタンスのModelMBeanInfo (Descriptor付き)を設定します。 ModelMBeanのModelMBeanInfoで公開された属性とオペレーションには、MBean、コネクタ、アダプタからアクセスできます。 ModelMBeanInfo Descriptorを使って、管理対象アプリケーション内の値とメソッドを定義し、ModelMBeanの属性およびオペレーションにマップすることができます。 このマッピングは、XML形式のファイルを使った開発時、または実行時にプログラムを使って動的に定義できます。

    ModelMBean内でインスタンス化される各ModelMBeanが管理対象になります。これらの属性およびオペレーションには、MBeanServerに接続されたコネクタまたはアダプタ経由でリモート・アクセスできます。 JMX準拠のMBeanでないJavaオブジェクトは、MBeanServerに登録できません。 リソースは、ModelMBeanをインスタンス化することにより、MBeanの有効性を保証します。

    すべてのpublicメソッドで、MBeanExceptionおよびRuntimeOperationsExceptionがスローされる必要があります。 こうすることにより、分散型通信(RMI、EJBなど)による例外をラップできます。 仕様およびjavadocに記載されているシナリオ以外では、実装が必ずしもこれらの例外をスローするとは限りません。

    導入されたバージョン:
    1.5
    • メソッドの詳細

      • sendNotification

        void sendNotification​(Notification ntfyObj)
                       throws MBeanException,
                              RuntimeOperationsException
        ModelMBean上の登録済みNotificationリスナーに、jmx.modelmbean.generic通知として渡されるNotificationを送信します。
        パラメータ:
        ntfyObj - リスナー・オブジェクトのhandleNotificationメソッドに渡される通知。
        例外:
        MBeanException - 分散通信Exceptionをラップする。
        RuntimeOperationsException - IllegalArgumentExceptionをラップする場合: パラメータとして渡されたNotificationオブジェクトがnullの場合。
      • sendNotification

        void sendNotification​(String ntfyText)
                       throws MBeanException,
                              RuntimeOperationsException
        ModelMBean上の登録済みNotificationリスナーに渡されるテキスト文字列を含むNotificationを送信します。
        パラメータ:
        ntfyText - Notificationに指定され、リスナー・オブジェクトのhandleNotificationメソッドに渡されるテキスト。構築されるNotificationを次に示す。type: "jmx.modelmbean.generic"、source: このModelMBeanインスタンス、sequence: 1
        例外:
        MBeanException - 分散通信Exceptionをラップする。
        RuntimeOperationsException - IllegalArgumentExceptionをラップする場合: パラメータとして渡されたNotificationテキスト文字列がnullの場合。
      • sendAttributeChangeNotification

        void sendAttributeChangeNotification​(AttributeChangeNotification notification)
                                      throws MBeanException,
                                             RuntimeOperationsException
        ModelMBean上の登録済みattributeChangeNotificationリスナーに渡されるattributeChangeNotificationを送信します。
        パラメータ:
        notification - リスナー・オブジェクトのhandleNotificationメソッドに渡される通知。
        例外:
        MBeanException - 分散通信Exceptionをラップする。
        RuntimeOperationsException - IllegalArgumentExceptionをラップする場合: パラメータとして渡されたAttributeChangeNotificationオブジェクトがnullの場合。
      • sendAttributeChangeNotification

        void sendAttributeChangeNotification​(Attribute oldValue,
                                             Attribute newValue)
                                      throws MBeanException,
                                             RuntimeOperationsException
        ModelMBean上の登録済みAttributeChangeNotificationリスナーに、属性の古い値と新しい値を含むattributeChangeNotificationを送信します。
        パラメータ:
        oldValue - Attributeの初期値
        newValue - Attributeの現在の値
         The constructed attributeChangeNotification will be:
           type        "jmx.attribute.change"
           source      this ModelMBean instance
           sequence    1
           attributeName oldValue.getName()
           attributeType oldValue's class
           attributeOldValue oldValue.getValue()
           attributeNewValue newValue.getValue()
         
        例外:
        MBeanException - 分散通信Exceptionをラップする。
        RuntimeOperationsException - IllegalArgumentExceptionをラップする場合: パラメータとして渡されるAttributeオブジェクトがnullである場合、またはパラメータに同じ名前のAttributeオブジェクトが複数指定された場合。
      • addAttributeChangeNotificationListener

        void addAttributeChangeNotificationListener​(NotificationListener listener,
                                                    String attributeName,
                                                    Object handback)
                                             throws MBeanException,
                                                    RuntimeOperationsException,
                                                    IllegalArgumentException
        NotificationListenerインタフェースを実装するオブジェクトをリスナーとして登録します。 ModelMBeanによって任意のattributeChangeNotificationが発行されると、このオブジェクトのhandleNotification()メソッドが呼び出されます。 その他のNotificationは含みません。 これらは個別に登録する必要があります。 このattributeName用のAttributeChangeNotificationが生成されます。
        パラメータ:
        listener - 登録済みMBeanが発行した通知を処理するリスナー・オブジェクト。
        attributeName - ModelMBean属性の名前。この属性の変更通知を受信する。 nullの場合、どの属性が変更されたときもattributeChangeNotificationが発行される。
        handback - 通知が発行されたとき通知とともにリスナーに送信されるコンテキスト。
        例外:
        IllegalArgumentException - リスナーはnullにできない。
        MBeanException - 分散通信Exceptionをラップする。
        RuntimeOperationsException - IllegalArgumentExceptionをラップする。パラメータとして渡される属性名が存在しない場合。
        関連項目:
        removeAttributeChangeNotificationListener(javax.management.NotificationListener, java.lang.String)