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
- 関連項目:
- 直列化された形式
- 
フィールドのサマリーフィールドクラス javax.management.Notificationで宣言されたフィールドsource
- 
コンストラクタのサマリーコンストラクタコンストラクタ説明MBeanServerNotification(String type, Object source, long sequenceNumber, ObjectName objectName)通知と指定の通知型を発行したMBeanのオブジェクト名を指定する、MBeanServerNotificationオブジェクトを作成します。
- 
メソッドのサマリークラス javax.management.Notificationで宣言されたメソッドgetMessage, getSequenceNumber, getTimeStamp, getType, getUserData, setSequenceNumber, setSource, setTimeStamp, setUserData, toStringクラス java.util.EventObjectで宣言されたメソッドgetSource
- 
フィールド詳細- 
REGISTRATION_NOTIFICATIONpublic static final String REGISTRATION_NOTIFICATIONMBeanが登録されたことを示す通知型です。 値は「JMX.mbean.registered」になります。- 関連項目:
- 定数フィールド値
 
- 
UNREGISTRATION_NOTIFICATIONpublic static final String UNREGISTRATION_NOTIFICATIONMBeanの登録が解除されたことを示す通知型です。 値は「JMX.mbean.unregistered」になります。- 関連項目:
- 定数フィールド値
 
 
- 
- 
コンストラクタの詳細- 
MBeanServerNotificationpublic MBeanServerNotification(String type, Object source, long sequenceNumber, ObjectName objectName)通知と指定の通知型を発行したMBeanのオブジェクト名を指定する、MBeanServerNotificationオブジェクトを作成します。- パラメータ:
- type- 通知型を表す文字列。- REGISTRATION_NOTIFICATIONまたは- UNREGISTRATION_NOTIFICATIONに設定する。
- source- MBeanサーバー通知を転送するMBeanServerNotificationオブジェクト。
- sequenceNumber- 受信した通知の並べ替えに使用できるシーケンス番号。
- objectName- 通知を発行したMBeanのオブジェクト名。
 
 
- 
- 
メソッドの詳細- 
getMBeanNamepublic ObjectName getMBeanName()通知を発行したMBeanのオブジェクト名を返します。- 戻り値:
- 通知を発行したMBeanのオブジェクト名。
 
 
-