Example usage for javax.management MBeanServerInvocationHandler MBeanServerInvocationHandler

List of usage examples for javax.management MBeanServerInvocationHandler MBeanServerInvocationHandler

Introduction

In this page you can find the example usage for javax.management MBeanServerInvocationHandler MBeanServerInvocationHandler.

Prototype

public MBeanServerInvocationHandler(MBeanServerConnection connection, ObjectName objectName, boolean isMXBean) 

Source Link

Document

Invocation handler that can forward methods through an MBean server to a Standard MBean or MXBean.

Usage

From source file:org.springframework.jmx.access.MBeanClientInterceptor.java

/**
 * Ensures that an {@code MBeanServerConnection} is configured and attempts
 * to detect a local connection if one is not supplied.
 *///from   ww w  . j  a  va2 s . co m
public void prepare() {
    synchronized (this.preparationMonitor) {
        if (this.server != null) {
            this.serverToUse = this.server;
        } else {
            this.serverToUse = null;
            this.serverToUse = this.connector.connect(this.serviceUrl, this.environment, this.agentId);
        }
        this.invocationHandler = null;
        if (this.useStrictCasing) {
            Assert.state(this.objectName != null, "No ObjectName set");
            // Use the JDK's own MBeanServerInvocationHandler, in particular for native MXBean support.
            this.invocationHandler = new MBeanServerInvocationHandler(this.serverToUse, this.objectName,
                    (this.managementInterface != null && JMX.isMXBeanInterface(this.managementInterface)));
        } else {
            // Non-strict casing can only be achieved through custom invocation handling.
            // Only partial MXBean support available!
            retrieveMBeanInfo(this.serverToUse);
        }
    }
}