- すべての実装されたインタフェース:
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を作成します。通知は、指定したNotificationEmitter
により処理されます。protected
StandardEmitterMBean(Class<?> mbeanInterface, NotificationEmitter emitter)
管理インタフェースがmbeanInterface
で指定されたMBeanを作成します。通知は、指定したNotificationEmitter
により処理されます。StandardEmitterMBean(T implementation, Class<T> mbeanInterface, boolean isMXBean, NotificationEmitter emitter)
指定された実装を持ち、指定されたNotificationEmitter
で通知が処理される、管理インタフェースがmbeanInterface
で指定されたMBeanを作成します。StandardEmitterMBean(T implementation, Class<T> mbeanInterface, NotificationEmitter emitter)
指定された実装を持ち、指定されたNotificationEmitter
で通知が処理される、管理インタフェースがmbeanInterface
で指定されたMBeanを作成します。 -
メソッドのサマリー
修飾子と型 メソッド 説明 void
sendNotification(Notification n)
通知を送信します。クラス javax.management.StandardMBeanで宣言されたメソッド
cacheMBeanInfo, getCachedMBeanInfo, getClassName, getConstructors, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getImpact, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, getParameterName, getParameterName, postDeregister, postRegister, preDeregister, preRegister, setImplementation
クラス java.lang.Objectで宣言されたメソッド
clone、equals、finalize、getClass、hashCode、notify、notifyAll、toString、wait、wait、wait
インタフェース javax.management.DynamicMBeanで宣言されたメソッド
getAttribute, getAttributes, invoke, setAttribute, setAttributes
インタフェース javax.management.NotificationBroadcasterで宣言されたメソッド
addNotificationListener, getNotificationInfo, removeNotificationListener
-
コンストラクタの詳細
-
StandardEmitterMBean
public StandardEmitterMBean(T implementation, Class<T> mbeanInterface, NotificationEmitter emitter)指定された実装を持ち、指定された
NotificationEmitter
で通知が処理される、管理インタフェースがmbeanInterface
で指定されたMBeanを作成します。 生成されるMBeanは、そのメソッドをemitter
に転送することにより、NotificationEmitter
インタフェースを実装します。implementation
およびemitter
を同じオブジェクトにすることは、正当で有用です。emitter
がNotificationBroadcasterSupport
のインスタンスである場合、MBeanのsendNotification
メソッドはemitter.
sendNotification
を呼び出します。NotificationBroadcaster.getNotificationInfo()
によって新しいMBeanに返される配列は、構築時にemitter.
getNotificationInfo()
によって返される配列のコピーです。emitter.getNotificationInfo()
により返された配列があとで変更されても、オブジェクトのgetNotificationInfo()
が影響を受けることはありません。- 型パラメータ:
T
- MBeanの実装型- パラメータ:
implementation
- MBeanインタフェースの実装。mbeanInterface
- Standard MBeanインタフェース。emitter
- 通知を処理するオブジェクト。- 例外:
IllegalArgumentException
-mbeanInterface
が管理インタフェースのJMX設計パターンに従っていない場合、指定されたimplementation
が指定されたインタフェースを実装していない場合、またはemitter
がnullの場合。
-
StandardEmitterMBean
public 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
を呼び出します。NotificationBroadcaster.getNotificationInfo()
によって新しいMBeanに返される配列は、構築時に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
を呼び出します。NotificationBroadcaster.getNotificationInfo()
によって新しいMBeanに返される配列は、構築時に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
を呼び出します。NotificationBroadcaster.getNotificationInfo()
によって新しいMBeanに返される配列は、構築時にemitter.
getNotificationInfo()
によって返される配列のコピーです。emitter.getNotificationInfo()
により返された配列があとで変更されても、オブジェクトのgetNotificationInfo()
が影響を受けることはありません。このコンストラクタの呼出しは、指定した
mbeanInterface
を実装するサブクラスから行う必要があります。- パラメータ:
mbeanInterface
- StandardMBeanインタフェース。isMXBean
- trueの場合、mbeanInterface
パラメータによりMXBeanインタフェースが指定され、結果のMBeanはMXBeanになる。emitter
- 通知を処理するオブジェクト。- 例外:
IllegalArgumentException
-mbeanInterface
が管理インタフェースのJMX設計パターンに従っていない場合、this
が指定されたインタフェースを実装していない場合、またはemitter
がnullの場合。
-
-
メソッドの詳細
-
sendNotification
public void sendNotification(Notification n)通知を送信します。
コンストラクタに渡される
emitter
パラメータがNotificationBroadcasterSupport
のインスタンスであった場合、このメソッドはemitter.
sendNotification
を呼び出します。- パラメータ:
n
- 送信する通知。- 例外:
ClassCastException
- コンストラクタに渡されるemitter
パラメータがNotificationBroadcasterSupport
でなかった場合。
-