Home » openjdk-7 » javax » management » [javadoc | source]
javax.management
public class: MBeanServerInvocationHandler [javadoc | source]
java.lang.Object
   javax.management.MBeanServerInvocationHandler

All Implemented Interfaces:
    InvocationHandler

InvocationHandler that forwards methods in an MBean's management interface through the MBean server to the MBean.

Given an MBeanServerConnection , the ObjectName of an MBean within that MBean server, and a Java interface Intf that describes the management interface of the MBean using the patterns for a Standard MBean or an MXBean, this class can be used to construct a proxy for the MBean. The proxy implements the interface Intf such that all of its methods are forwarded through the MBean server to the MBean.

If the {@code InvocationHandler} is for an MXBean, then the parameters of a method are converted from the type declared in the MXBean interface into the corresponding mapped type, and the return value is converted from the mapped type into the declared type. For example, with the method
{@code public List reverse(List list);}
and given that the mapped type for {@code List} is {@code String[]}, a call to {@code proxy.reverse(someList)} will convert {@code someList} from a {@code List} to a {@code String[]}, call the MBean operation {@code reverse}, then convert the returned {@code String[]} into a {@code List}.

The method Object.toString(), Object.hashCode(), or Object.equals(Object), when invoked on a proxy using this invocation handler, is forwarded to the MBean server as a method on the proxied MBean only if it appears in one of the proxy's interfaces. For a proxy created with ObjectName, Class) JMX.newMBeanProxy or ObjectName, Class) JMX.newMXBeanProxy , this means that the method must appear in the Standard MBean or MXBean interface. Otherwise these methods have the following behavior:

Constructor:
 public MBeanServerInvocationHandler(MBeanServerConnection connection,
    ObjectName objectName) 
    Parameters:
    connection - the MBean server connection through which all methods of a proxy using this handler will be forwarded.
    objectName - the name of the MBean within the MBean server to which methods will be forwarded.
 public MBeanServerInvocationHandler(MBeanServerConnection connection,
    ObjectName objectName,
    boolean isMXBean) 
    Parameters:
    connection - the MBean server connection through which all methods of a proxy using this handler will be forwarded.
    objectName - the name of the MBean within the MBean server to which methods will be forwarded.
    isMXBean - if true, the proxy is for an MXBean , and appropriate mappings will be applied to method parameters and return values.
    since: 1.6 -
Method from javax.management.MBeanServerInvocationHandler Summary:
getMBeanServerConnection,   getObjectName,   invoke,   isMXBean,   newProxyInstance
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.management.MBeanServerInvocationHandler Detail:
 public MBeanServerConnection getMBeanServerConnection() 

    The MBean server connection through which the methods of a proxy using this handler are forwarded.

 public ObjectName getObjectName() 

    The name of the MBean within the MBean server to which methods are forwarded.

 public Object invoke(Object proxy,
    Method method,
    Object[] args) throws Throwable 
 public boolean isMXBean() 

    If true, the proxy is for an MXBean, and appropriate mappings are applied to method parameters and return values.

 public static T newProxyInstance(MBeanServerConnection connection,
    ObjectName objectName,
    Class<T> interfaceClass,
    boolean notificationBroadcaster)