public class JMX extends Object
| 修飾子と型 | フィールドと説明 |
|---|---|
static String |
DEFAULT_VALUE_FIELD
defaultValueフィールドの名前。 |
static String |
IMMUTABLE_INFO_FIELD
immutableInfoフィールドの名前。 |
static String |
INTERFACE_CLASS_NAME_FIELD
interfaceClassNameフィールドの名前。 |
static String |
LEGAL_VALUES_FIELD
legalValuesフィールドの名前。 |
static String |
MAX_VALUE_FIELD
maxValueフィールドの名前。 |
static String |
MIN_VALUE_FIELD
minValueフィールドの名前。 |
static String |
MXBEAN_FIELD
mxbeanフィールドの名前。 |
static String |
OPEN_TYPE_FIELD
openTypeフィールドの名前。 |
static String |
ORIGINAL_TYPE_FIELD
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のメソッドもサポートする場合があります。 |
public static final String DEFAULT_VALUE_FIELD
defaultValueフィールドの名前。public static final String IMMUTABLE_INFO_FIELD
immutableInfoフィールドの名前。public static final String INTERFACE_CLASS_NAME_FIELD
interfaceClassNameフィールドの名前。public static final String LEGAL_VALUES_FIELD
legalValuesフィールドの名前。public static final String ORIGINAL_TYPE_FIELD
originalTypeフィールドの名前。public static <T> T newMBeanProxy(MBeanServerConnection connection, ObjectName objectName, Class<T> interfaceClass)
ローカルまたはリモートのMBean Server内にStandard MBeanのプロキシを作成します。
MBean Server mbsにObjectName 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です。このオブジェクトのInvocationHandlerはMBeanServerInvocationHandlerです。
このメソッドは、newMBeanProxy(connection, objectName, interfaceClass, false)と同等です。
T - たとえば、interfaceClassパラメータがMyMBean.classであれば、戻り値の型はMyMBeanになることをコンパイラに知らせる。connection - 送信先のMBeanサーバー。objectName - connection内で渡されるMBeanの名前。interfaceClass - MBeanがエクスポートする管理インタフェース。これも返されるプロキシにより実装される。IllegalArgumentException - interfaceClassが準拠するMBeanインタフェースでない場合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インタフェースでない場合public static <T> T newMXBeanProxy(MBeanServerConnection connection, ObjectName objectName, Class<T> interfaceClass)
MBean Server mbsにObjectName 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のコンテキスト内で変更されることはありません。属性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が準拠するMBeanインタフェースでない場合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が準拠するMBeanインタフェースでない場合public static boolean isMXBeanInterface(Class<?> interfaceClass)
インタフェースがMXBeanインタフェースかどうかをテストします。インタフェースがpublicで、@MXBeanまたは@MXBean(true)が注釈として付加されているか、@MXBeanの注釈がなく、名前が「MXBean」で終わる場合は、MXBeanインタフェースです。
interfaceClass - 候補のインタフェース。interfaceClassが準拠するMBeanインタフェースである場合はtrueNullPointerException - interfaceClassがnullである場合。 バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright© 1993, 2014, Oracle and/or its affiliates. All rights reserved.