Example usage for org.springframework.jmx.support JmxUtils parameterInfoToTypes

List of usage examples for org.springframework.jmx.support JmxUtils parameterInfoToTypes

Introduction

In this page you can find the example usage for org.springframework.jmx.support JmxUtils parameterInfoToTypes.

Prototype

@Nullable
public static Class<?>[] parameterInfoToTypes(@Nullable MBeanParameterInfo[] paramInfo,
        @Nullable ClassLoader classLoader) throws ClassNotFoundException 

Source Link

Document

Convert an array of MBeanParameterInfo into an array of Class instances corresponding to the parameters.

Usage

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

/**
 * Loads the management interface info for the configured MBean into the caches.
 * This information is used by the proxy when determining whether an invocation matches
 * a valid operation or attribute on the management interface of the managed resource.
 *///w  w  w .ja va 2 s .  c o  m
private void retrieveMBeanInfo(MBeanServerConnection server) throws MBeanInfoRetrievalException {
    try {
        MBeanInfo info = server.getMBeanInfo(this.objectName);

        MBeanAttributeInfo[] attributeInfo = info.getAttributes();
        this.allowedAttributes = new HashMap<>(attributeInfo.length);
        for (MBeanAttributeInfo infoEle : attributeInfo) {
            this.allowedAttributes.put(infoEle.getName(), infoEle);
        }

        MBeanOperationInfo[] operationInfo = info.getOperations();
        this.allowedOperations = new HashMap<>(operationInfo.length);
        for (MBeanOperationInfo infoEle : operationInfo) {
            Class<?>[] paramTypes = JmxUtils.parameterInfoToTypes(infoEle.getSignature(), this.beanClassLoader);
            this.allowedOperations.put(new MethodCacheKey(infoEle.getName(), paramTypes), infoEle);
        }
    } catch (ClassNotFoundException ex) {
        throw new MBeanInfoRetrievalException("Unable to locate class specified in method signature", ex);
    } catch (IntrospectionException ex) {
        throw new MBeanInfoRetrievalException("Unable to obtain MBean info for bean [" + this.objectName + "]",
                ex);
    } catch (InstanceNotFoundException ex) {
        // if we are this far this shouldn't happen, but...
        throw new MBeanInfoRetrievalException(
                "Unable to obtain MBean info for bean [" + this.objectName
                        + "]: it is likely that this bean was unregistered during the proxy creation process",
                ex);
    } catch (ReflectionException ex) {
        throw new MBeanInfoRetrievalException("Unable to read MBean info for bean [ " + this.objectName + "]",
                ex);
    } catch (IOException ex) {
        throw new MBeanInfoRetrievalException("An IOException occurred when communicating with the "
                + "MBeanServer. It is likely that you are communicating with a remote MBeanServer. "
                + "Check the inner exception for exact details.", ex);
    }
}