- 導入されたバージョン:
- 1.6
-
フィールドのサマリー
フィールド修飾子と型フィールド説明static final StringdefaultValueフィールドの名前。static final StringimmutableInfoフィールドの名前。static final StringinterfaceClassNameフィールドの名前。static final StringlegalValuesフィールドの名前。static final StringmaxValueフィールドの名前。static final StringminValueフィールドの名前。static final Stringmxbeanフィールドの名前。static final StringopenTypeフィールドの名前。static final StringoriginalTypeフィールドの名前。 -
メソッドのサマリー
修飾子と型メソッド説明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_FIELDdefaultValueフィールドの名前。- 関連項目:
-
IMMUTABLE_INFO_FIELD
public static final String IMMUTABLE_INFO_FIELDimmutableInfoフィールドの名前。- 関連項目:
-
INTERFACE_CLASS_NAME_FIELD
public static final String INTERFACE_CLASS_NAME_FIELDinterfaceClassNameフィールドの名前。- 関連項目:
-
LEGAL_VALUES_FIELD
public static final String LEGAL_VALUES_FIELDlegalValuesフィールドの名前。- 関連項目:
-
MAX_VALUE_FIELD
public static final String MAX_VALUE_FIELDmaxValueフィールドの名前。- 関連項目:
-
MIN_VALUE_FIELD
public static final String MIN_VALUE_FIELDminValueフィールドの名前。- 関連項目:
-
MXBEAN_FIELD
public static final String MXBEAN_FIELDmxbeanフィールドの名前。- 関連項目:
-
OPEN_TYPE_FIELD
public static final String OPEN_TYPE_FIELDopenTypeフィールドの名前。- 関連項目:
-
ORIGINAL_TYPE_FIELD
public static final String ORIGINAL_TYPE_FIELDoriginalTypeフィールドの名前。- 関連項目:
-
-
メソッドの詳細
-
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である場合。
-