类 JmxUtils


  • public abstract class JmxUtils
    extends Object
    Collection of generic utility methods to support Spring JMX. Includes a convenient method to locate an MBeanServer.
    从以下版本开始:
    1.2
    作者:
    Rob Harrop, Juergen Hoeller
    另请参阅:
    locateMBeanServer()
    • 构造器详细资料

    • 方法详细资料

      • locateMBeanServer

        public static MBeanServer locateMBeanServer​(String agentId)
                                             throws MBeanServerNotFoundException
        Attempt to find a locally running MBeanServer. Fails if no MBeanServer can be found. Logs a warning if more than one MBeanServer found, returning the first one from the list.
        参数:
        agentId - the agent identifier of the MBeanServer to retrieve. If this parameter is null, all registered MBeanServers are considered. If the empty String is given, the platform MBeanServer will be returned.
        返回:
        the MBeanServer if found
        抛出:
        MBeanServerNotFoundException - if no MBeanServer could be found
        另请参阅:
        MBeanServerFactory.findMBeanServer(String)
      • getMethodSignature

        public static String[] getMethodSignature​(Method method)
        Create a String[] representing the argument signature of a method. Each element in the array is the fully qualified class name of the corresponding argument in the methods signature.
        参数:
        method - the method to build an argument signature for
        返回:
        the signature as array of argument types
      • getAttributeName

        public static String getAttributeName​(PropertyDescriptor property,
                                              boolean useStrictCasing)
        Return the JMX attribute name to use for the given JavaBeans property.

        When using strict casing, a JavaBean property with a getter method such as getFoo() translates to an attribute called Foo. With strict casing disabled, getFoo() would translate to just foo.

        参数:
        property - the JavaBeans property descriptor
        useStrictCasing - whether to use strict casing
        返回:
        the JMX attribute name to use
      • getClassToExpose

        public static Class<?> getClassToExpose​(Object managedBean)
        Return the class or interface to expose for the given bean. This is the class that will be searched for attributes and operations (for example, checked for annotations).

        This implementation returns the superclass for a CGLIB proxy and the class of the given bean else (for a JDK proxy or a plain bean class).

        参数:
        managedBean - the bean instance (might be an AOP proxy)
        返回:
        the bean class to expose
        另请参阅:
        ClassUtils.getUserClass(Object)
      • getClassToExpose

        public static Class<?> getClassToExpose​(Class<?> clazz)
        Return the class or interface to expose for the given bean class. This is the class that will be searched for attributes and operations (for example, checked for annotations).

        This implementation returns the superclass for a CGLIB proxy and the class of the given bean else (for a JDK proxy or a plain bean class).

        参数:
        clazz - the bean class (might be an AOP proxy class)
        返回:
        the bean class to expose
        另请参阅:
        ClassUtils.getUserClass(Class)
      • isMBean

        public static boolean isMBean​(Class<?> clazz)
        Determine whether the given bean class qualifies as an MBean as-is.

        This implementation checks for DynamicMBean classes as well as classes with corresponding "*MBean" interface (Standard MBeans) or corresponding "*MXBean" interface (Java 6 MXBeans).

        参数:
        clazz - the bean class to analyze
        返回:
        whether the class qualifies as an MBean
        另请参阅:
        MBeanExporter.isMBean(Class)
      • getMBeanInterface

        public static Class<?> getMBeanInterface​(Class<?> clazz)
        Return the Standard MBean interface for the given class, if any (that is, an interface whose name matches the class name of the given class but with suffix "MBean").
        参数:
        clazz - the class to check
        返回:
        the Standard MBean interface for the given class
      • getMXBeanInterface

        public static Class<?> getMXBeanInterface​(Class<?> clazz)
        Return the Java 6 MXBean interface exists for the given class, if any (that is, an interface whose name ends with "MXBean" and/or carries an appropriate MXBean annotation).
        参数:
        clazz - the class to check
        返回:
        whether there is an MXBean interface for the given class
      • isMXBeanSupportAvailable

        @Deprecated
        public static boolean isMXBeanSupportAvailable()
        已过时。
        as of Spring 4.0, since Java 6 is required anyway now
        Check whether MXBean support is available, i.e. whether we're running on Java 6 or above.
        返回:
        true if available; false otherwise