Class JmxUtils

  • All Implemented Interfaces:
    Utils

    public abstract class JmxUtils
    extends java.lang.Object
    implements Utils
    The utilities class for JMX
    Since:
    1.0.0
    Author:
    Mercy
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      protected static java.lang.Object doGetAttribute​(javax.management.MBeanServer mBeanServer, javax.management.ObjectName objectName, javax.management.MBeanAttributeInfo attributeInfo, java.lang.String attributeName)  
      static javax.management.MBeanAttributeInfo findMBeanAttributeInfo​(javax.management.MBeanServer mBeanServer, javax.management.ObjectName objectName, java.lang.String attributeName)  
      static java.lang.Object getAttribute​(javax.management.MBeanServer mBeanServer, javax.management.ObjectName objectName, java.lang.String attributeName)  
      static java.lang.Object getAttribute​(javax.management.MBeanServer mBeanServer, javax.management.ObjectName objectName, javax.management.MBeanAttributeInfo attributeInfo)  
      static java.lang.management.ClassLoadingMXBean getClassLoadingMXBean()
      Returns the managed bean for the class loading system of the Java virtual machine.
      static java.util.Optional<java.lang.management.CompilationMXBean> getCompilationMXBean()
      Returns the managed bean for the compilation system of the Java virtual machine.
      static java.util.List<java.lang.management.GarbageCollectorMXBean> getGarbageCollectorMXBeans()
      Returns a list of GarbageCollectorMXBean objects in the Java virtual machine.
      static MBeanAttribute[] getMBeanAttributes​(javax.management.MBeanServer mBeanServer, javax.management.ObjectName objectName)
      Get the MBeanAttributes from the specified named MBean and its' registered MBeanServer Note that the array of MBeanAttributes is the same order of MBeanInfo.getAttributes()
      static java.util.Map<java.lang.String,​MBeanAttribute> getMBeanAttributesMap​(javax.management.MBeanServer mBeanServer, javax.management.ObjectName objectName)
      Get the Map with the attribute name and MBeanAttributes from the specified named MBean and its' registered MBeanServer
      static javax.management.MBeanInfo getMBeanInfo​(javax.management.MBeanServer mBeanServer, javax.management.ObjectName objectName)  
      static java.util.List<java.lang.management.MemoryManagerMXBean> getMemoryManagerMXBeans()
      Returns a list of MemoryManagerMXBean objects in the Java virtual machine.
      static java.lang.management.MemoryMXBean getMemoryMXBean()
      Returns the managed bean for the memory system of the Java virtual machine.
      static java.util.List<java.lang.management.MemoryPoolMXBean> getMemoryPoolMXBeans()
      Returns a list of MemoryPoolMXBean objects in the Java virtual machine.
      static java.lang.management.OperatingSystemMXBean getOperatingSystemMXBean()
      Returns the managed bean for the operating system on which the Java virtual machine is running.
      static java.lang.management.RuntimeMXBean getRuntimeMXBean()
      Returns the managed bean for the runtime system of the Java virtual machine.
      static java.lang.management.ThreadMXBean getThreadMXBean()
      Returns the managed bean for the thread system of the Java virtual machine.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EMPTY_MBEAN_ATTRIBUTE_ARRAY

        public static final MBeanAttribute[] EMPTY_MBEAN_ATTRIBUTE_ARRAY
    • Method Detail

      • getClassLoadingMXBean

        @Nonnull
        public static java.lang.management.ClassLoadingMXBean getClassLoadingMXBean()
        Returns the managed bean for the class loading system of the Java virtual machine.
        Returns:
        a ClassLoadingMXBean object for the Java virtual machine.
      • getMemoryMXBean

        @Nonnull
        public static java.lang.management.MemoryMXBean getMemoryMXBean()
        Returns the managed bean for the memory system of the Java virtual machine.
        Returns:
        a MemoryMXBean object for the Java virtual machine.
      • getThreadMXBean

        @Nonnull
        public static java.lang.management.ThreadMXBean getThreadMXBean()
        Returns the managed bean for the thread system of the Java virtual machine.
        Returns:
        a ThreadMXBean object for the Java virtual machine.
      • getRuntimeMXBean

        @Nonnull
        public static java.lang.management.RuntimeMXBean getRuntimeMXBean()
        Returns the managed bean for the runtime system of the Java virtual machine.
        Returns:
        a RuntimeMXBean object for the Java virtual machine.
      • getCompilationMXBean

        @Nullable
        public static java.util.Optional<java.lang.management.CompilationMXBean> getCompilationMXBean()
        Returns the managed bean for the compilation system of the Java virtual machine. This method returns null if the Java virtual machine has no compilation system.
        Returns:
        an instance of Optional holding a CompilationMXBean object for the Java virtual machine or {@code null if the Java virtual machine has no compilation system.
      • getOperatingSystemMXBean

        @Nonnull
        public static java.lang.management.OperatingSystemMXBean getOperatingSystemMXBean()
        Returns the managed bean for the operating system on which the Java virtual machine is running.
        Returns:
        an OperatingSystemMXBean object for the Java virtual machine.
      • getMemoryPoolMXBeans

        @Nonnull
        public static java.util.List<java.lang.management.MemoryPoolMXBean> getMemoryPoolMXBeans()
        Returns a list of MemoryPoolMXBean objects in the Java virtual machine. The Java virtual machine can have one or more memory pools. It may add or remove memory pools during execution.
        Returns:
        a list of MemoryPoolMXBean objects.
      • getMemoryManagerMXBeans

        @Nonnull
        public static java.util.List<java.lang.management.MemoryManagerMXBean> getMemoryManagerMXBeans()
        Returns a list of MemoryManagerMXBean objects in the Java virtual machine. The Java virtual machine can have one or more memory managers. It may add or remove memory managers during execution.
        Returns:
        a list of MemoryManagerMXBean objects.
      • getGarbageCollectorMXBeans

        @Nonnull
        public static java.util.List<java.lang.management.GarbageCollectorMXBean> getGarbageCollectorMXBeans()
        Returns a list of GarbageCollectorMXBean objects in the Java virtual machine. The Java virtual machine may have one or more GarbageCollectorMXBean objects. It may add or remove GarbageCollectorMXBean during execution.
        Returns:
        a list of GarbageCollectorMXBean objects.
      • getMBeanAttributesMap

        @Nonnull
        public static java.util.Map<java.lang.String,​MBeanAttribute> getMBeanAttributesMap​(javax.management.MBeanServer mBeanServer,
                                                                                                 javax.management.ObjectName objectName)
        Get the Map with the attribute name and MBeanAttributes from the specified named MBean and its' registered MBeanServer
        Parameters:
        mBeanServer - MBeanServer
        objectName - the name of MBean
        Returns:
        non-null read-only Map
      • getMBeanAttributes

        @Nonnull
        public static MBeanAttribute[] getMBeanAttributes​(javax.management.MBeanServer mBeanServer,
                                                          javax.management.ObjectName objectName)
        Get the MBeanAttributes from the specified named MBean and its' registered MBeanServer Note that the array of MBeanAttributes is the same order of MBeanInfo.getAttributes()
        Parameters:
        mBeanServer - MBeanServer
        objectName - the name of MBean
        Returns:
        non-null array
      • getAttribute

        public static java.lang.Object getAttribute​(javax.management.MBeanServer mBeanServer,
                                                    javax.management.ObjectName objectName,
                                                    javax.management.MBeanAttributeInfo attributeInfo)
      • getAttribute

        public static java.lang.Object getAttribute​(javax.management.MBeanServer mBeanServer,
                                                    javax.management.ObjectName objectName,
                                                    java.lang.String attributeName)
      • findMBeanAttributeInfo

        public static javax.management.MBeanAttributeInfo findMBeanAttributeInfo​(javax.management.MBeanServer mBeanServer,
                                                                                 javax.management.ObjectName objectName,
                                                                                 java.lang.String attributeName)
      • doGetAttribute

        protected static java.lang.Object doGetAttribute​(javax.management.MBeanServer mBeanServer,
                                                         javax.management.ObjectName objectName,
                                                         @Nullable
                                                         javax.management.MBeanAttributeInfo attributeInfo,
                                                         java.lang.String attributeName)
      • getMBeanInfo

        public static javax.management.MBeanInfo getMBeanInfo​(javax.management.MBeanServer mBeanServer,
                                                              javax.management.ObjectName objectName)