- java.lang.Object
-
- javax.management.JMX
-
public class JMX extends Object
JMX APIからのstaticメソッドです。 このクラスのインスタンスは存在しません。- 導入されたバージョン:
- 1.6
-
-
フィールドのサマリー
フィールド 修飾子と型 フィールド 説明 static StringDEFAULT_VALUE_FIELDdefaultValueフィールドの名前。static StringIMMUTABLE_INFO_FIELDimmutableInfoフィールドの名前。static StringINTERFACE_CLASS_NAME_FIELDinterfaceClassNameフィールドの名前。static StringLEGAL_VALUES_FIELDlegalValuesフィールドの名前。static StringMAX_VALUE_FIELDmaxValueフィールドの名前。static StringMIN_VALUE_FIELDminValueフィールドの名前。static StringMXBEAN_FIELDmxbeanフィールドの名前。static StringOPEN_TYPE_FIELDopenTypeフィールドの名前。static StringORIGINAL_TYPE_FIELDoriginalTypeフィールドの名前。
-
メソッドのサマリー
すべてのメソッド 静的メソッド 具象メソッド 修飾子と型 メソッド 説明 static booleanisMXBeanInterface(Class<?> interfaceClass)インタフェースがMXBeanインタフェースかどうかをテストします。static <T> TnewMBeanProxy(MBeanServerConnection connection, ObjectName objectName, Class<T> interfaceClass)ローカルまたはリモートのMBean Server内にStandard MBeanのプロキシを作成します。static <T> TnewMBeanProxy(MBeanServerConnection connection, ObjectName objectName, Class<T> interfaceClass, boolean notificationEmitter)ローカルまたはリモートのMBean Server内にStandard MBean用のプロキシを作成します。これは、NotificationEmitterのメソッドもサポートする場合があります。static <T> TnewMXBeanProxy(MBeanServerConnection connection, ObjectName objectName, Class<T> interfaceClass)ローカルまたはリモートのMBean Server内にMXBeanのプロキシを作成します。static <T> TnewMXBeanProxy(MBeanServerConnection connection, ObjectName objectName, Class<T> interfaceClass, boolean notificationEmitter)ローカルまたはリモートのMBean Server内にMXBean用のプロキシを作成します。これは、NotificationEmitterのメソッドもサポートする場合があります。
-
-
-
フィールドの詳細
-
DEFAULT_VALUE_FIELD
public static final String DEFAULT_VALUE_FIELD
defaultValueフィールドの名前。- 関連項目:
- 定数フィールド値
-
IMMUTABLE_INFO_FIELD
public static final String IMMUTABLE_INFO_FIELD
immutableInfoフィールドの名前。- 関連項目:
- 定数フィールド値
-
INTERFACE_CLASS_NAME_FIELD
public static final String INTERFACE_CLASS_NAME_FIELD
interfaceClassNameフィールドの名前。- 関連項目:
- 定数フィールド値
-
LEGAL_VALUES_FIELD
public static final String LEGAL_VALUES_FIELD
legalValuesフィールドの名前。- 関連項目:
- 定数フィールド値
-
ORIGINAL_TYPE_FIELD
public static final String ORIGINAL_TYPE_FIELD
originalTypeフィールドの名前。- 関連項目:
- 定数フィールド値
-
-
メソッドの詳細
-
newMBeanProxy
public static <T> T newMBeanProxy(MBeanServerConnection connection, ObjectName objectName, Class<T> interfaceClass)
ローカルまたはリモートのMBean Server内にStandard MBeanのプロキシを作成します。
MBean Server
mbsにObjectNamenameを持つ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です。このオブジェクトのInvocationHandlerはMBeanServerInvocationHandlerです。このメソッドは、
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(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.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
mbsにObjectNamenameを持つ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); publicMemoryUsagegetMappedAttribute(); 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のコンテキスト内で変更されることはありません。 属性SimpleAttributeに対するMXBeanプロキシの動作はStandard 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です。このオブジェクトのInvocationHandlerはMBeanServerInvocationHandlerです。このメソッドは、
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(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.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である場合。
-
-