JavaTM Platform
Standard Ed. 6

javax.management
クラス StandardEmitterMBean

java.lang.Object
  上位を拡張 javax.management.StandardMBean
      上位を拡張 javax.management.StandardEmitterMBean
すべての実装されたインタフェース:
DynamicMBean, MBeanRegistration, NotificationBroadcaster, NotificationEmitter

public class StandardEmitterMBean
extends StandardMBean
implements NotificationEmitter

 

Java インタフェースのリフレクションによって管理インタフェースを決定し、通知を発行する MBean です。

 

次の例は、public コンストラクタ StandardEmitterMBean(implementation, mbeanInterface, emitter) を使用して、任意の実装クラス名 Impl、任意のインタフェース Intf で定義された管理インタフェース (現在の Standard MBean 用)、およびインタフェース NotificationEmitter の任意の実装を指定し、通知を発行する MBean を作成する方法を示しています。この例では、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

コンストラクタの概要
protected StandardEmitterMBean(Class<?> mbeanInterface, boolean isMXBean, NotificationEmitter emitter)
           mbeanInterface により管理インタフェースが指定される MBean を作成します。
protected StandardEmitterMBean(Class<?> mbeanInterface, NotificationEmitter emitter)
           mbeanInterface により管理インタフェースが指定される MBean を作成します。
  StandardEmitterMBean(T implementation, Class<T> mbeanInterface, boolean isMXBean, NotificationEmitter emitter)
           指定した実装を使用し、mbeanInterface により管理インタフェースが指定される MBean を作成します。
  StandardEmitterMBean(T implementation, Class<T> mbeanInterface, NotificationEmitter emitter)
           指定した実装を使用し、mbeanInterface により管理インタフェースが指定される MBean を作成します。
 
メソッドの概要
 void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
          この MBean にリスナーを追加します。
 MBeanNotificationInfo[] getNotificationInfo()
           この MBean が送信する可能性のある各通知について、その通知の Java クラス名と通知型を示す配列を返します。
 void removeNotificationListener(NotificationListener listener)
          この MBean からリスナーを削除します。
 void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
           この MBean からリスナーを削除します。
 void sendNotification(Notification n)
           通知を送信します。
 
クラス javax.management.StandardMBean から継承されたメソッド
cacheMBeanInfo, getAttribute, getAttributes, getCachedMBeanInfo, getClassName, getConstructors, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getImpact, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, getParameterName, getParameterName, invoke, postDeregister, postRegister, preDeregister, preRegister, setAttribute, setAttributes, setImplementation
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

StandardEmitterMBean

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

指定した実装を使用し、mbeanInterface により管理インタフェースが指定される MBean を作成します。通知は、指定した NotificationEmitter により処理されます。生成される MBean は、そのメソッドを emitter に転送することにより、NotificationEmitter インタフェースを実装します。implementation および emitter を同じオブジェクトにするのは、正当で有用です。

 

emitterNotificationBroadcasterSupport のインスタンスである場合、MBean の sendNotification メソッドは emitter.sendNotification を呼び出します。

 

新規 MBean に対する getNotificationInfo() により返される配列は、構築時に emitter.getNotificationInfo() により返される配列のコピーです。emitter.getNotificationInfo() により返された配列があとで変更されても、オブジェクトの getNotificationInfo() が影響を受けることはありません。

パラメータ:
implementation - MBean インタフェースの実装
mbeanInterface - Standard MBean インタフェース
emitter - 通知を処理するオブジェクト
例外:
IllegalArgumentException - mbeanInterface が管理インタフェースの JMX 設計パターンに従っていない場合、指定された implementation が特定のインタフェースを実装していない場合、または emitter が null の場合

StandardEmitterMBean

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

指定した実装を使用し、mbeanInterface により管理インタフェースが指定される MBean を作成します。通知は、指定した NotificationEmitter により処理されます。このコンストラクタは、Standard MBean または MXBean の作成に使用できます。生成される MBean は、そのメソッドを emitter に転送することにより、NotificationEmitter インタフェースを実装します。implementation および emitter を同じオブジェクトにするのは、正当で有用です。

 

emitterNotificationBroadcasterSupport のインスタンスである場合、MBean の sendNotification メソッドは emitter.sendNotification を呼び出します。

 

新規 MBean に対する getNotificationInfo() により返される配列は、構築時に emitter.getNotificationInfo() により返される配列のコピーです。emitter.getNotificationInfo() により返された配列があとで変更されても、オブジェクトの getNotificationInfo() が影響を受けることはありません。

パラメータ:
implementation - MBean インタフェースの実装
mbeanInterface - Standard MBean インタフェース
isMXBean - true の場合、mbeanInterface パラメータにより MXBean インタフェースが命名され、生成される MBean は MXBean になる
emitter - 通知を処理するオブジェクト
例外:
IllegalArgumentException - mbeanInterface が管理インタフェースの JMX 設計パターンに従っていない場合、指定された implementation が特定のインタフェースを実装していない場合、または emitter が null の場合

StandardEmitterMBean

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

mbeanInterface により管理インタフェースが指定される MBean を作成します。通知は、指定した NotificationEmitter により処理されます。生成される MBean は、そのメソッドを emitter に転送することにより、NotificationEmitter インタフェースを実装します。

 

emitterNotificationBroadcasterSupport のインスタンスである場合、MBean の sendNotification メソッドは emitter.sendNotification を呼び出します。

 

新規 MBean に対する getNotificationInfo() により返される配列は、構築時に emitter.getNotificationInfo() により返される配列のコピーです。emitter.getNotificationInfo() により返された配列があとで変更されても、オブジェクトの getNotificationInfo() が影響を受けることはありません。

 

このコンストラクタの呼び出しは、指定した mbeanInterface を実装するサブクラスから行う必要があります。

パラメータ:
mbeanInterface - StandardMBean インタフェース
emitter - 通知を処理するオブジェクト
例外:
IllegalArgumentException - mbeanInterface が管理インタフェースの JMX 設計パターンに従っていない場合、this が特定のインタフェースを実装していない場合、または emitter が null の場合

StandardEmitterMBean

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

mbeanInterface により管理インタフェースが指定される MBean を作成します。通知は、指定した NotificationEmitter により処理されます。このコンストラクタは、Standard MBean または MXBean の作成に使用できます。生成される MBean は、そのメソッドを emitter に転送することにより、NotificationEmitter インタフェースを実装します。

 

emitterNotificationBroadcasterSupport のインスタンスである場合、MBean の sendNotification メソッドは emitter.sendNotification を呼び出します。

 

新規 MBean に対する getNotificationInfo() により返される配列は、構築時に emitter.getNotificationInfo() により返される配列のコピーです。emitter.getNotificationInfo() により返された配列があとで変更されても、オブジェクトの getNotificationInfo() が影響を受けることはありません。

 

このコンストラクタの呼び出しは、指定した mbeanInterface を実装するサブクラスから行う必要があります。

パラメータ:
mbeanInterface - StandardMBean インタフェース
isMXBean - true の場合、mbeanInterface パラメータにより MXBean インタフェースが命名され、生成される MBean は MXBean になる
emitter - 通知を処理するオブジェクト
例外:
IllegalArgumentException - mbeanInterface が管理インタフェースの JMX 設計パターンに従っていない場合、this が特定のインタフェースを実装していない場合、または emitter が null の場合
メソッドの詳細

removeNotificationListener

public void removeNotificationListener(NotificationListener listener)
                                throws ListenerNotFoundException
インタフェース NotificationBroadcaster の記述:
この MBean からリスナーを削除します。リスナーが別のハンドバックオブジェクトまたは通知フィルタに登録されている場合、このリスナーに対応するすべてのエントリが削除されます。

定義:
インタフェース NotificationBroadcaster 内の removeNotificationListener
パラメータ:
listener - 以前にこの MBean に追加されたリスナー
例外:
ListenerNotFoundException - リスナーが MBean に 登録されていない場合
関連項目:
NotificationBroadcaster.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object), NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)

removeNotificationListener

public void removeNotificationListener(NotificationListener listener,
                                       NotificationFilter filter,
                                       Object handback)
                                throws ListenerNotFoundException
インタフェース NotificationEmitter の記述:
 

この MBean からリスナーを削除します。MBean は、指定された listenerfilter、および handback パラメータと正確に一致するリスナーを持っている必要があります。該当するリスナーが複数存在する場合、そのうちの 1 つだけが削除されます。

 

削除されるリスナー内で null が指定されている場合、filter および handback パラメータは null になります。

定義:
インタフェース NotificationEmitter 内の removeNotificationListener
パラメータ:
listener - 以前にこの MBean に追加されたリスナー
filter - リスナーの追加時に指定されたフィルタ
handback - リスナーの追加時に指定されたハンドバック
例外:
ListenerNotFoundException - リスナーが MBean に 登録されていない場合、または指定されたフィルタおよびハンドバックで 登録されていない場合

addNotificationListener

public void addNotificationListener(NotificationListener listener,
                                    NotificationFilter filter,
                                    Object handback)
インタフェース NotificationBroadcaster の記述:
この MBean にリスナーを追加します。

定義:
インタフェース NotificationBroadcaster 内の addNotificationListener
パラメータ:
listener - ブロードキャスタが発行した通知を 処理するリスナーオブジェクト
filter - フィルタオブジェクト。フィルタが null の場合、通知処理の前にフィルタは適用されない
handback - 通知の発行時にリスナーに送信される 不透明なオブジェクト。Notification ブロードキャスタオブジェクトは、 このオブジェクトを使用できない。このオブジェクトは、手を加えない状態で、 通知とともにリスナーへ送り返されなければならない
関連項目:
NotificationBroadcaster.removeNotificationListener(javax.management.NotificationListener)

getNotificationInfo

public MBeanNotificationInfo[] getNotificationInfo()
インタフェース NotificationBroadcaster の記述:
 

この MBean が送信する可能性のある各通知について、その通知の Java クラス名と通知型を示す配列を返します。

 

この配列に記述されていない通知を MBean が送信しても、不正ではありません。ただし一部の MBean サーバークライアントは、正しく機能するために、作成される配列に依存する場合があります。

定義:
インタフェース NotificationBroadcaster 内の getNotificationInfo
戻り値:
通知の配列

sendNotification

public void sendNotification(Notification n)
 

通知を送信します。

 

コンストラクタに渡される emitter パラメータが NotificationBroadcasterSupport のインスタンスであった場合、このメソッドは emitter.sendNotification を呼び出します。

パラメータ:
n - 送信する通知
例外:
ClassCastException - コンストラクタに渡される emitter パラメータが NotificationBroadcasterSupport でなかった場合

JavaTM Platform
Standard Ed. 6

バグの報告と機能のリクエスト
さらに詳しい API リファレンスおよび開発者ドキュメントについては、Java SE 開発者用ドキュメントを参照してください。開発者向けの詳細な解説、概念の概要、用語の定義、バグの回避策、およびコード実例が含まれています。

Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。