Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
javax.management.JMX
Field Summary | |
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
Method Summary | |
static |
|
static |
|
static |
|
static boolean |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public static final String DEFAULT_VALUE_FIELD
The name of the defaultValue field.
- Field Value:
- "defaultValue"
public static final String IMMUTABLE_INFO_FIELD
The name of the immutableInfo field.
- Field Value:
- "immutableInfo"
public static final String INTERFACE_CLASS_NAME_FIELD
The name of the interfaceClassName field.
- Field Value:
- "interfaceClassName"
public static final String LEGAL_VALUES_FIELD
The name of the legalValues field.
- Field Value:
- "legalValues"
public static final String MAX_VALUE_FIELD
The name of the maxValue field.
- Field Value:
- "maxValue"
public static final String MIN_VALUE_FIELD
The name of the minValue field.
- Field Value:
- "minValue"
public static final String MXBEAN_FIELD
The name of the mxbean field.
- Field Value:
- "mxbean"
public static final String OPEN_TYPE_FIELD
The name of the openType field.
- Field Value:
- "openType"
public static final String ORIGINAL_TYPE_FIELD
The name of the originalType field.
- Field Value:
- "originalType"
public staticT newMBeanProxy(MBeanServerConnection conn, ObjectName name, Class iface)
Returns a proxy for a standard management bean, using the specified connection to access the named implementation. To create a proxy for the bean,SomethingMBean
, a call toJMX.newMBeanProxy(server, name, SomethingMBean.class)
is made, whereserver
is a local or remote management server, andname
is the registeredObjectName
of the implementation ofSomethingMBean
to use. The proxy redirects calls to the methods of the interface,SomethingMBean
, to the appropriate methods of the management server. IfSomethingMBean
is specified as follows:public interface SomethingMBean { String getName(); void setName(String name); void doStuff(); }The proxy created above will provide these three methods using an instance ofMBeanServerInvocationHandler
. The two methods,getName
andsetName
define an attribute,Name
, so a call togetName()
will return the value ofserver.getAttribute(name, "Name")
, whilesetName(newName)
will result in a call toserver.setAttribute(name, new Attribute("Name", newName))
. Finally,doStuff()
, as an operation, will cause the proxy to callMBeanServer.invoke(ObjectName,String,Object[],String[])
asserver.invoke(name, "doStuff", null, null)
. Calling this method is equivalent to callingnewMBeanProxy(MBeanServerConnection, ObjectName, Class, boolean)
.
- Parameters:
conn
- the server connection over which to forward calls to the bean.name
- the registered name of the bean to use to implement the given interface.iface
- the interface to provide a proxy for.
- Returns:
- a proxy implementing the specified interface using calls to the methods of the bean registered with the supplied server using the given name.
- See Also:
newMBeanProxy(MBeanServerConnection, ObjectName, Class, boolean)
public staticT newMBeanProxy(MBeanServerConnection conn, ObjectName name, Class iface, boolean bcast)
Returns a proxy for a standard management bean, using the specified connection to access the named implementation, as withnewMBeanProxy(MBeanServerConnection, ObjectName, Class)
. In addition, the proxy returned by this method will also implementNotificationEmitter
ifbcast
is true, under the assumption that the implementation referenced byname
implements this interface. Calls to the methods ofNotificationEmitter
will be forwarded to the bean implementation via the appropriate server methods.
- Parameters:
conn
- the server connection over which to forward calls to the bean.name
- the registered name of the bean to use to implement the given interface.iface
- the interface to provide a proxy for.bcast
- true if the proxy should implementNotificationEmitter
.
- Returns:
- a proxy implementing the specified interface using calls to the methods of the bean registered with the supplied server using the given name.
- See Also:
newMBeanProxy(MBeanServerConnection, ObjectName, Class)
public staticT newMXBeanProxy(MBeanServerConnection conn, ObjectName name, Class iface)
Returns a proxy for aMXBean
, using the specified connection to access the named implementation. To create a proxy for the bean,SomethingMXBean
, a call toJMX.newMXBeanProxy(server, name, SomethingMXBean.class)
is made, whereserver
is a local or remote management server, andname
is the registeredObjectName
of the implementation ofSomethingMBean
to use. The proxy redirects calls to the methods of the interface,SomethingMXBean
, to the appropriate methods of the management server with appropriate conversion between Java and open types, according to the MXBean rules. IfSomethingMXBean
is specified as follows:public interface SomethingMXBean { String getName(); void setName(String name); ListThe proxy created above will provide these five methods using an instance ofgetStatistics(); void setStatistics(List statistics); List getNamedStatistics(String, Map ); } MBeanServerInvocationHandler
. The two methods,getName
andsetName
define an attribute,Name
, so a call togetName()
will return the value ofserver.getAttribute(name, "Name")
, whilesetName(newName)
will result in a call toserver.setAttribute(name, new Attribute("Name", newName))
. As this uses a simple type,String
, no conversion is necessary. The two methods,getStatistics
andsetStatistics
similarly define another attribute,Statistics
. CallinggetStatistics()
will cause a call to the server to be made as before,server.getAttribute(name, "Statistics")
. However, the type of the return value from this call will be an array ofDouble
objects, as per theMXBean
rules. The proxy converts this back in to aList
ofDouble
objects before returning it. The same process is applied in reverse forsetStatistics(newStats)
. The list is converted into an appropriate array before the call toMBeanServerConnection.setAttribute(ObjectName,Attribute)
is made. Finally, a call togetNamedStatistics
will require both a Java to open type conversion on the arguments, and then an open type to Java conversion of the return value. Thus, a proxy enables anMXBean
to be used in cases where the appropriate Java types are available and the user wishes to access the bean using the types directly defined in its interface, just as with standard management beans. Calling this method is equivalent to callingnewMXBeanProxy(MBeanServerConnection, ObjectName, Class, boolean)
.
- Parameters:
conn
- the server connection over which to forward calls to the bean.name
- the registered name of the bean to use to implement the given interface.iface
- the interface to provide a proxy for.
- Returns:
- a proxy implementing the specified interface using calls to the methods of the bean registered with the supplied server using the given name.
- See Also:
newMXBeanProxy(MBeanServerConnection, ObjectName, Class, boolean)
public static boolean isMXBeanInterface(Class> iface)
Returns true if the given class represents anMXBean
interface. An interface is aninterface
if:
- It is annotated with
@MXBean
or@MXBean(true)
- Its name ends in
"MXBean"
and it does not have anMXBean
annotation.
- Parameters:
iface
- the interface class that is to be checked forMXBean
status.
- Returns:
- true if the interface represents an
MXBean
.
- Throws:
NullPointerException
- ififace
isnull
.