クラスStandardEmitterMBean
- すべての実装されたインタフェース:
DynamicMBean, MBeanRegistration, NotificationBroadcaster, 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
- 関連項目:
-
コンストラクタのサマリー
コンストラクタ修飾子コンストラクタ説明protectedStandardEmitterMBean(Class<?> mbeanInterface, boolean isMXBean, NotificationEmitter emitter) 管理インタフェースがmbeanInterfaceで指定されたMBeanを作成します。通知は、指定したNotificationEmitterにより処理されます。protectedStandardEmitterMBean(Class<?> mbeanInterface, NotificationEmitter emitter) 管理インタフェースがmbeanInterfaceで指定されたMBeanを作成します。通知は、指定したNotificationEmitterにより処理されます。<T>StandardEmitterMBean(T implementation, Class<T> mbeanInterface, boolean isMXBean, NotificationEmitter emitter) 指定された実装を持ち、指定されたNotificationEmitterで通知が処理される、管理インタフェースがmbeanInterfaceで指定されたMBeanを作成します。<T>StandardEmitterMBean(T implementation, Class<T> mbeanInterface, NotificationEmitter emitter) 指定された実装を持ち、指定されたNotificationEmitterで通知が処理される、管理インタフェースがmbeanInterfaceで指定されたMBeanを作成します。 -
メソッドのサマリー
修飾子と型メソッド説明voidaddNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) このMBeanにリスナーを追加します。このMBeanが送信する可能性のある各通知について、その通知のJavaクラス名と通知タイプを示す配列を返します。voidこのMBeanからリスナーを削除します。voidremoveNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) このMBeanからリスナーを削除します。void通知を送信します。クラスで宣言されたメソッド 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修飾子と型メソッド説明protected voidcacheMBeanInfo(MBeanInfo info) カスタマイズ・フック: このオブジェクト用に構築されたMBeanInfoをキャッシュに入れます。getAttribute(String attribute) Dynamic MBeanの特定の属性の値を取得します。getAttributes(String[] attributes) Dynamic MBeanの複数の属性の値を取得します。protected MBeanInfoカスタマイズ・フック: このオブジェクト用にキャッシュされたMBeanInfoを返します。protected StringgetClassName(MBeanInfo info) カスタマイズ・フック: このMBeanから返されるMBeanInfoで使用されるclassNameを取得します。protected MBeanConstructorInfo[]getConstructors(MBeanConstructorInfo[] ctors, Object impl) カスタマイズ・フック: このMBeanから返されるMBeanInfoで使用されるMBeanConstructorInfo[]を取得します。protected Stringカスタマイズ・フック: このMBeanから返されるMBeanAttributeInfoで使用される説明を取得します。protected Stringカスタマイズ・フック: このMBeanから返されるMBeanConstructorInfoで使用される説明を取得します。protected StringgetDescription(MBeanConstructorInfo ctor, MBeanParameterInfo param, int sequence) カスタマイズ・フック: このMBeanから返されるMBeanConstructorInfoのsequence MBeanParameterInfoに使用される説明を取得します。protected Stringカスタマイズ・フック: このMBeanから返されるMBeanFeatureInfoで使用される説明を取得します。protected StringgetDescription(MBeanInfo info) カスタマイズ・フック: このMBeanから返されるMBeanInfoで使用される説明を取得します。protected Stringカスタマイズ・フック: このMBeanから返されるMBeanOperationInfoで使用される説明を取得します。protected StringgetDescription(MBeanOperationInfo op, MBeanParameterInfo param, int sequence) カスタマイズ・フック: このMBeanから返されるMBeanOperationInfoのsequence MBeanParameterInfoに使用される説明を取得します。protected intgetImpact(MBeanOperationInfo info) カスタマイズ・フック: このMBeanから返されるMBeanOperationInfoで使用されるオペレーションのimpactフラグを取得します。このStandard MBean (またはMXBean)の実装を取得します。Class<?> このStandard MBean (またはMXBean)の実装のクラスを取得します。このMBeanのMBeanInfoを取得します。final Class<?> このStandard MBean (またはMXBean)の管理インタフェースを取得します。protected StringgetParameterName(MBeanConstructorInfo ctor, MBeanParameterInfo param, int sequence) カスタマイズ・フック: このMBeanから返されるMBeanConstructorInfoのsequence MBeanParameterInfoに使用される名前を取得します。protected StringgetParameterName(MBeanOperationInfo op, MBeanParameterInfo param, int sequence) カスタマイズ・フック: このMBeanから返されるMBeanOperationInfoのsequence MBeanParameterInfoに使用される名前を取得します。Dynamic MBean上でのアクションの呼出しを許可します。voidMBeanサーバーから登録解除したあと、MBeanが必要なオペレーションを実行できるようにします。voidpostRegister(Boolean registrationDone) MBeanサーバーへの登録が成功または失敗したあと、MBeanが必要なオペレーションを実行できるようにします。voidMBeanサーバーから登録解除する前に、MBeanが必要なオペレーションを実行できるようにします。preRegister(MBeanServer server, ObjectName name) MBeanサーバーに登録する前に、MBeanが必要なオペレーションを実行できるようにします。voidsetAttribute(Attribute attribute) Dynamic MBeanの特定の属性の値を設定します。setAttributes(AttributeList attributes) Dynamic MBeanの複数の属性の値を設定します。voidsetImplementation(Object implementation) このオブジェクト内のラップされた実装オブジェクトを置換します。クラスオブジェクトで宣言されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait修飾子と型メソッド説明protected Objectclone()このオブジェクトのコピーを作成して、返します。booleanこのオブジェクトと他のオブジェクトが等しいかどうかを示します。protected voidfinalize()削除予定のため非推奨: このAPI要素は、将来のバージョンで削除される可能性があります。最終決定は非推奨であり、将来のリリースで削除される可能性があります。final Class<?> getClass()このObjectの実行時クラスを返します。inthashCode()このオブジェクトに対するハッシュ・コード値を返します。final voidnotify()このオブジェクトのモニターで待機中のスレッドを1つ再開します。final voidこのオブジェクトのモニターで待機中のすべてのスレッドを再開します。toString()オブジェクトの文字列表現を返します。final voidwait()現在のスレッドが目覚めるまで待機します。通常、notifiedまたはinterruptedです。final voidwait(long timeoutMillis) 現在のスレッドは、通常、notifiedまたはinterruptedであるか、一定のリアルタイムが経過するまで、目覚めるまで待機します。final voidwait(long timeoutMillis, int nanos) 現在のスレッドは、通常、notifiedまたはinterruptedであるか、一定のリアルタイムが経過するまで、目覚めるまで待機します。
-
コンストラクタの詳細
-
StandardEmitterMBean
public <T> StandardEmitterMBean(T implementation, Class<T> mbeanInterface, NotificationEmitter emitter) 指定された実装を持ち、指定された
NotificationEmitterで通知が処理される、管理インタフェースがmbeanInterfaceで指定されたMBeanを作成します。 生成されるMBeanは、そのメソッドをemitterに転送することにより、NotificationEmitterインタフェースを実装します。implementationおよびemitterを同じオブジェクトにすることは、正当で有用です。emitterがNotificationBroadcasterSupportのインスタンスである場合、MBeanのsendNotificationメソッドはemitter.sendNotificationを呼び出します。新規MBeanで
getNotificationInfo()により返される配列は、構築時にemitter.getNotificationInfo()により返される配列のコピーです。emitter.getNotificationInfo()により返された配列があとで変更されても、オブジェクトのgetNotificationInfo()が影響を受けることはありません。- 型パラメータ:
T- MBeanの実装型- パラメータ:
implementation- MBeanインタフェースの実装。mbeanInterface- Standard MBeanインタフェース。emitter- 通知を処理するオブジェクト。- スロー:
IllegalArgumentException-mbeanInterfaceが管理インタフェースのJMX設計パターンに従っていない場合、指定されたimplementationが指定されたインタフェースを実装していない場合、またはemitterがnullの場合。
-
StandardEmitterMBean
public <T> StandardEmitterMBean(T implementation, Class<T> mbeanInterface, boolean isMXBean, NotificationEmitter emitter) 指定された実装を持ち、指定された
NotificationEmitterで通知が処理される、管理インタフェースがmbeanInterfaceで指定されたMBeanを作成します。 このコンストラクタは、Standard MBeanまたはMXBeanの作成に使用できます。 生成されるMBeanは、そのメソッドをemitterに転送することにより、NotificationEmitterインタフェースを実装します。implementationおよびemitterを同じオブジェクトにすることは、正当で有用です。emitterがNotificationBroadcasterSupportのインスタンスである場合、MBeanのsendNotificationメソッドはemitter.sendNotificationを呼び出します。新規MBeanで
getNotificationInfo()により返される配列は、構築時にemitter.getNotificationInfo()により返される配列のコピーです。emitter.getNotificationInfo()により返された配列があとで変更されても、オブジェクトのgetNotificationInfo()が影響を受けることはありません。- 型パラメータ:
T- MBeanの実装型- パラメータ:
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インタフェースを実装します。emitterがNotificationBroadcasterSupportのインスタンスである場合、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インタフェースを実装します。emitterがNotificationBroadcasterSupportのインスタンスである場合、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からリスナーを削除します。 リスナーが別のハンドバック・オブジェクトまたは通知フィルタに登録されている場合、このリスナーに対応するすべてのエントリが削除されます。- 定義:
removeNotificationListener、インタフェースNotificationBroadcaster- パラメータ:
listener- 以前にこのMBeanに追加されたリスナー。- スロー:
ListenerNotFoundException- リスナーがMBeanに登録されていない場合。- 関連項目:
-
removeNotificationListener
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException インタフェースからコピーされた説明:NotificationEmitterこのMBeanからリスナーを削除します。 MBeanは、指定された
listener、filter、およびhandbackパラメータと正確に一致するリスナーを持っている必要があります。 該当するリスナーが複数存在する場合、そのうちの1つだけが削除されます。削除されるリスナー内でnullが指定されている場合にのみ、
filterおよびhandbackパラメータはnullになります。- 定義:
removeNotificationListener、インタフェースNotificationEmitter- パラメータ:
listener- 以前にこのMBeanに追加されたリスナー。filter- リスナーの追加時に指定されたフィルタ。handback- リスナーの追加時に指定されたハンドバック。- スロー:
ListenerNotFoundException- リスナーがMBeanに登録されていない場合、または指定されたフィルタおよびハンドバックで登録されていない場合。
-
addNotificationListener
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) インタフェースからコピーされた説明:NotificationBroadcasterこのMBeanにリスナーを追加します。- 定義:
addNotificationListener、インタフェースNotificationBroadcaster- パラメータ:
listener- ブロードキャスタが発行した通知を処理するリスナー・オブジェクト。filter- フィルタ・オブジェクト。 フィルタがnullの場合、通知処理の前にフィルタは適用されない。handback- 通知の発行時にリスナーに送信される不透明なオブジェクト。 Notificationブロードキャスタ・オブジェクトは、このオブジェクトを使用できない。 このオブジェクトは、手を加えない状態で、通知とともにリスナーへ送り返されなければならない。- 関連項目:
-
getNotificationInfo
public MBeanNotificationInfo[] getNotificationInfo()インタフェースからコピーされた説明:NotificationBroadcasterこのMBeanが送信する可能性のある各通知について、その通知のJavaクラス名と通知タイプを示す配列を返します。
この配列に記述されていない通知をMBeanが送信しても、不正ではありません。 ただし一部のMBeanサーバー・クライアントは、正しく機能するために、作成される配列に依存する場合があります。
- 定義:
getNotificationInfo、インタフェースNotificationBroadcaster- 戻り値:
- 可能な通知の配列。
-
sendNotification
public void sendNotification(Notification n) 通知を送信します。
コンストラクタに渡される
emitterパラメータがNotificationBroadcasterSupportのインスタンスであった場合、このメソッドはemitter.sendNotificationを呼び出します。- パラメータ:
n- 送信する通知。- スロー:
ClassCastException- コンストラクタに渡されるemitterパラメータがNotificationBroadcasterSupportでなかった場合。
-