- java.lang.Object
-
- java.util.EventObject
-
- javax.management.Notification
-
- javax.management.MBeanServerNotification
-
- すべての実装されたインタフェース:
Serializable
public class MBeanServerNotification extends Notification
MBeanサーバーにより、MBeanServerDelegate MBeanから発行される通知を表します。 MBeanサーバーは、MBean登録型またはMBean登録解除型の通知を発行します。MBeanServerNotificationを受信するには、MBeanServerを表すMBean、
MBeanServerDelegate
にリスナーを登録する必要があります。 MBeanServerDelegateのObjectNameは、JMImplementation:type=MBeanServerDelegate
であるMBeanServerDelegate.DELEGATE_NAME
です。次のコードは、MBeanサーバー
mbeanServer
にMBeanが登録または登録解除されるたびにメッセージを出力します。private static final NotificationListener printListener = new NotificationListener() { public void handleNotification(Notification n, Object handback) { if (!(n instanceof MBeanServerNotification)) { System.out.println("Ignored notification of class " + n.getClass().getName()); return; } MBeanServerNotification mbsn = (MBeanServerNotification) n; String what; if (n.getType().equals(MBeanServerNotification.REGISTRATION_NOTIFICATION)) what = "MBean registered"; else if (n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) what = "MBean unregistered"; else what = "Unknown type " + n.getType(); System.out.println("Received MBean Server notification: " + what + ": " + mbsn.getMBeanName()); } }; ... mbeanServer.addNotificationListener( MBeanServerDelegate.DELEGATE_NAME, printListener, null, null);
MBeanServerDelegate
以外のMBeanもMBeanServerNotificationを発行できます。 特に、MBeanがMBeanのグループのMBeanServerNotificationを発行する規則があります。MBeanのグループの登録または登録解除を示すために発行されたMBeanServerNotificationには、次の特徴があります。
- 通知型は
"JMX.mbean.registered.group"
または"JMX.mbean.unregistered.group"
であり、通知型にREGISTRATION_NOTIFICATION
+".group"
またはUNREGISTRATION_NOTIFICATION
+".group"
を書き込むこともできる。 - MBean名は、登録または登録解除されたMBeanのセット(またはスーパー・セット)を選択するObjectNameパターンである
- オプションで、ユーザー・データを、登録または登録解除されたすべてのMBeanの名前を含むObjectNameの配列に設定できる。
MBeanグループの登録/登録解除の通知は、それを発行するMBeanにより
MBeanNotificationInfo
内に宣言されます。- 導入されたバージョン:
- 1.5
- 関連項目:
- 直列化された形式
-
-
フィールドのサマリー
フィールド 修飾子と型 フィールド 説明 static String
REGISTRATION_NOTIFICATION
MBeanが登録されたことを示す通知型です。static String
UNREGISTRATION_NOTIFICATION
MBeanの登録が解除されたことを示す通知型です。-
クラス javax.management.Notificationで宣言されたフィールド
source
-
-
コンストラクタのサマリー
コンストラクタ コンストラクタ 説明 MBeanServerNotification(String type, Object source, long sequenceNumber, ObjectName objectName)
通知と指定の通知型を発行したMBeanのオブジェクト名を指定する、MBeanServerNotificationオブジェクトを作成します。
-
メソッドのサマリー
修飾子と型 メソッド 説明 ObjectName
getMBeanName()
通知を発行したMBeanのオブジェクト名を返します。-
クラス javax.management.Notificationで宣言されたメソッド
getMessage, getSequenceNumber, getTimeStamp, getType, getUserData, setSequenceNumber, setSource, setTimeStamp, setUserData, toString
-
クラス java.util.EventObjectで宣言されたメソッド
getSource
-
-
-
-
コンストラクタの詳細
-
MBeanServerNotification
public MBeanServerNotification(String type, Object source, long sequenceNumber, ObjectName objectName)
通知と指定の通知型を発行したMBeanのオブジェクト名を指定する、MBeanServerNotificationオブジェクトを作成します。- パラメータ:
type
- 通知型を表す文字列。REGISTRATION_NOTIFICATION
またはUNREGISTRATION_NOTIFICATION
に設定する。source
- MBeanサーバー通知を転送するMBeanServerNotificationオブジェクト。sequenceNumber
- 受信した通知の並べ替えに使用できるシーケンス番号。objectName
- 通知を発行したMBeanのオブジェクト名。
-
-
メソッドの詳細
-
getMBeanName
public ObjectName getMBeanName()
通知を発行したMBeanのオブジェクト名を返します。- 戻り値:
- 通知を発行したMBeanのオブジェクト名。
-
-