クラスJMX

java.lang.Object
javax.management.JMX

public class JMX extends Object
JMX APIからのstaticメソッドです。 このクラスのインスタンスは存在しません。
導入されたバージョン:
1.6
  • フィールドのサマリー

    フィールド
    修飾子と型
    フィールド
    説明
    static final String
    defaultValueフィールドの名前。
    static final String
    immutableInfoフィールドの名前。
    static final String
    interfaceClassNameフィールドの名前。
    static final String
    legalValuesフィールドの名前。
    static final String
    maxValueフィールドの名前。
    static final String
    minValueフィールドの名前。
    static final String
    mxbeanフィールドの名前。
    static final String
    openTypeフィールドの名前。
    static final String
    originalTypeフィールドの名前。
  • メソッドのサマリー

    修飾子と型
    メソッド
    説明
    static boolean
    isMXBeanInterface(Class<?> interfaceClass)
    インタフェースがMXBeanインタフェースかどうかをテストします。
    static <T> T
    newMBeanProxy(MBeanServerConnection connection, ObjectName objectName, Class<T> interfaceClass)
    ローカルまたはリモートのMBean Server内にStandard MBeanのプロキシを作成します。
    static <T> T
    newMBeanProxy(MBeanServerConnection connection, ObjectName objectName, Class<T> interfaceClass, boolean notificationEmitter)
    ローカルまたはリモートのMBean Server内にStandard MBean用のプロキシを作成します。これは、NotificationEmitterのメソッドもサポートする場合があります。
    static <T> T
    newMXBeanProxy(MBeanServerConnection connection, ObjectName objectName, Class<T> interfaceClass)
    ローカルまたはリモートのMBean Server内にMXBeanのプロキシを作成します。
    static <T> T
    newMXBeanProxy(MBeanServerConnection connection, ObjectName objectName, Class<T> interfaceClass, boolean notificationEmitter)
    ローカルまたはリモートのMBean Server内にMXBean用のプロキシを作成します。これは、NotificationEmitterのメソッドもサポートする場合があります。

    クラスオブジェクトで宣言されたメソッド

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    修飾子と型
    メソッド
    説明
    protected Object
    このオブジェクトのコピーを作成して、返します。
    boolean
    このオブジェクトと他のオブジェクトが等しいかどうかを示します。
    protected void
    削除予定のため非推奨: このAPI要素は、将来のバージョンで削除される可能性があります。
    最終決定は非推奨であり、将来のリリースで削除される可能性があります。
    final Class<?>
    このObjectの実行時クラスを返します。
    int
    このオブジェクトに対するハッシュ・コード値を返します。
    final void
    このオブジェクトのモニターで待機中のスレッドを1つ再開します。
    final void
    このオブジェクトのモニターで待機中のすべてのスレッドを再開します。
    オブジェクトの文字列表現を返します。
    final void
    現在のスレッドが目覚めるまで待機します。通常、notifiedまたはinterruptedです。
    final void
    wait(long timeoutMillis)
    現在のスレッドは、通常、notifiedまたはinterruptedであるか、一定のリアルタイムが経過するまで、目覚めるまで待機します。
    final void
    wait(long timeoutMillis, int nanos)
    現在のスレッドは、通常、notifiedまたはinterruptedであるか、一定のリアルタイムが経過するまで、目覚めるまで待機します。
  • フィールド詳細

  • メソッドの詳細

    • newMBeanProxy

      public static <T> T newMBeanProxy(MBeanServerConnection connection, ObjectName objectName, Class<T> interfaceClass)

      ローカルまたはリモートのMBean Server内にStandard MBeanのプロキシを作成します。

      MBean Server mbsObjectName nameを持つMBeanが含まれていて、MBeanの管理インタフェースがJavaインタフェースMyMBeanによって記述されている場合は、次のようにしてMBeanのプロキシを構築できます。

      MyMBean proxy = JMX.newMBeanProxy(mbs, name, MyMBean.class);
      

      MyMBeanは、次のようになります。

      public interface MyMBean {
          public String getSomeAttribute();
          public void setSomeAttribute(String value);
          public void someOperation(String param1, int param2);
      }
      

      これで、次の内容を実行できます。

      • proxy.getSomeAttribute()。これにより、mbs.getAttribute(name, "SomeAttribute")への呼出しが行われます。
      • proxy.setSomeAttribute("whatever")。これにより、mbs.setAttribute(name, new Attribute("SomeAttribute", "whatever"))への呼出しが行われます。
      • proxy.someOperation("param1", 2)。これが、mbs.invoke(name, "someOperation",<etc>)への呼出しに変換されます。

      このメソッドにより返されるオブジェクトは、Proxyです。このオブジェクトのInvocationHandlerMBeanServerInvocationHandlerです。

      このメソッドは、newMBeanProxy(connection, objectName, interfaceClass, false)と同等です。

      型パラメータ:
      T - interfaceClassパラメータがMyMBean.classの場合(たとえば、戻り型がMyMBeanの場合)に、コンパイラが認識できるようにします。
      パラメータ:
      connection - 送信先のMBeanサーバー。
      objectName - connection内で渡されるMBeanの名前。
      interfaceClass - MBeanがエクスポートする管理インタフェース。これも返されるプロキシにより実装される。
      戻り値:
      新しいプロキシのインスタンス。
      スロー:
      IllegalArgumentException - interfaceClass準拠するMBeanインタフェースでない場合
    • newMBeanProxy

      public static <T> T newMBeanProxy(MBeanServerConnection connection, ObjectName objectName, Class<T> interfaceClass, boolean notificationEmitter)

      ローカルまたはリモートのMBean Server内にStandard MBean用のプロキシを作成します。これは、NotificationEmitterのメソッドもサポートする場合があります。

      このメソッドの動作はnewMBeanProxy(MBeanServerConnection, ObjectName, Class)と同じですが、加えてnotificationEmitter trueの場合、MBeanはNotificationBroadcasterまたはNotificationEmitterであると見なされ、返されるプロキシはNotificationEmitterおよびinterfaceClassを実装します。 プロキシでNotificationBroadcaster.addNotificationListener(NotificationListener, NotificationFilter, Object)をコールすると、MBeanServerConnection.addNotificationListener(ObjectName, NotificationListener, NotificationFilter, Object)がコールされ、同様にNotificationBroadcasterおよびNotificationEmitterの他のメソッドもコールされます。

      型パラメータ:
      T - interfaceClassパラメータがMyMBean.classの場合(たとえば、戻り型がMyMBeanの場合)に、コンパイラが認識できるようにします。
      パラメータ:
      connection - 送信先のMBeanサーバー。
      objectName - connection内で渡されるMBeanの名前。
      interfaceClass - MBeanがエクスポートする管理インタフェース。これも返されるプロキシにより実装される。
      notificationEmitter - connection経由でメソッドを渡すことにより、返されたプロキシにNotificationEmitterを実装させる。
      戻り値:
      新しいプロキシのインスタンス。
      スロー:
      IllegalArgumentException - interfaceClass準拠するMBeanインタフェースでない場合
    • newMXBeanProxy

      public static <T> T newMXBeanProxy(MBeanServerConnection connection, ObjectName objectName, Class<T> interfaceClass)
      ローカルまたはリモートのMBean Server内にMXBeanのプロキシを作成します。

      MBean Server mbsObjectName nameを持つMXBeanが含まれていて、MXBeanの管理インタフェースがJavaインタフェースMyMXBeanによって記述されている場合は、次のようにしてMXBeanのプロキシを構築できます。

      MyMXBean proxy = JMX.newMXBeanProxy(mbs, name, MyMXBean.class);
      

      MyMXBeanは、次のようになります。

      public interface MyMXBean {
          public String getSimpleAttribute();
          public void setSimpleAttribute(String value);
          public MemoryUsage getMappedAttribute();
          public void setMappedAttribute(MemoryUsage memoryUsage);
          public MemoryUsage someOperation(String param1, MemoryUsage param2);
      }
      

      次に、

      • proxy.getSimpleAttribute()により、mbs.getAttribute(name, "SimpleAttribute")への呼出しが行われます。

      • proxy.setSimpleAttribute("whatever")により、mbs.setAttribute(name, new Attribute("SimpleAttribute", "whatever"))への呼出しが行われます。

        Stringは、SimpleTypeの意味ではSimple Typeであるため、MXBeanのコンテキスト内で変更されることはありません。 MXBeanプロキシの動作は、属性 SimpleAttributeの標準MBeanプロキシ(newMBeanProxyを参照してください)と同じです。

      • proxy.getMappedAttribute()により、mbs.getAttribute("MappedAttribute")への呼出しが行われます。 MXBeanマッピング・ルールに従うと、属性 MappedAttributeの実際の型はCompositeDataであり、これがmbs.getAttributeの呼出しで返されます。 次に、プロキシは、MXBeanマッピング・ルールを使って、CompositeDataを予期される型MemoryUsageに変換して戻します。

      • 同様に、proxy.setMappedAttribute(memoryUsage)は、MemoryUsage引数を CompositeDataに変換してからmbs.setAttributeを呼び出します。

      • proxy.someOperation("whatever", memoryUsage)は、MemoryUsage引数を CompositeDataに変換して、mbs.invokeを呼び出します。 mbs.invokeにより返される値もCompositeDataになります。プロキシは、MXBeanマッピング・ルールを使って、これを予期される型 MemoryUsageに変換します。

      このメソッドにより返されるオブジェクトは、Proxyです。このオブジェクトのInvocationHandlerMBeanServerInvocationHandlerです。

      このメソッドは、newMXBeanProxy(connection, objectName, interfaceClass, false)と同等です。

      型パラメータ:
      T - interfaceClassパラメータがMyMXBean.classの場合(たとえば、戻り型がMyMXBeanの場合)に、コンパイラが認識できるようにします。
      パラメータ:
      connection - 送信先のMBeanサーバー。
      objectName - connection内で渡されるMBeanの名前。
      interfaceClass - MXBeanインタフェース。これも返されるプロキシにより実装される。
      戻り値:
      新しいプロキシのインスタンス。
      スロー:
      IllegalArgumentException - interfaceClass準拠するMXBeanインタフェースでない場合
    • newMXBeanProxy

      public static <T> T newMXBeanProxy(MBeanServerConnection connection, ObjectName objectName, Class<T> interfaceClass, boolean notificationEmitter)

      ローカルまたはリモートのMBean Server内にMXBean用のプロキシを作成します。これは、NotificationEmitterのメソッドもサポートする場合があります。

      このメソッドの動作はnewMXBeanProxy(MBeanServerConnection, ObjectName, Class)と同じですが、加えてnotificationEmitter trueの場合、MXBeanはNotificationBroadcasterまたはNotificationEmitterであると見なされ、返されるプロキシはNotificationEmitterおよびinterfaceClassを実装します。 プロキシでNotificationBroadcaster.addNotificationListener(NotificationListener, NotificationFilter, Object)をコールすると、MBeanServerConnection.addNotificationListener(ObjectName, NotificationListener, NotificationFilter, Object)がコールされ、同様にNotificationBroadcasterおよびNotificationEmitterの他のメソッドもコールされます。

      型パラメータ:
      T - interfaceClassパラメータがMyMXBean.classの場合(たとえば、戻り型がMyMXBeanの場合)に、コンパイラが認識できるようにします。
      パラメータ:
      connection - 送信先のMBeanサーバー。
      objectName - connection内で渡されるMBeanの名前。
      interfaceClass - MXBeanインタフェース。これも返されるプロキシにより実装される。
      notificationEmitter - connection経由でメソッドを渡すことにより、返されたプロキシにNotificationEmitterを実装させる。
      戻り値:
      新しいプロキシのインスタンス。
      スロー:
      IllegalArgumentException - interfaceClass準拠するMXBeanインタフェースでない場合
    • isMXBeanInterface

      public static boolean isMXBeanInterface(Class<?> interfaceClass)

      インタフェースがMXBeanインタフェースかどうかをテストします。 インタフェースがpublicで、@MXBeanまたは@MXBean(true)が注釈として付加されているか、@MXBeanの注釈がなく、名前が「MXBean」で終わる場合は、MXBeanインタフェースです。

      パラメータ:
      interfaceClass - 候補のインタフェース。
      戻り値:
      interfaceClass準拠するMXBeanインタフェースである場合はtrue
      スロー:
      NullPointerException - interfaceClassがnullである場合。