Class ManagementUtils

java.lang.Object
org.jppf.utils.ManagementUtils

public class ManagementUtils extends Object
Author:
Laurent Cohen
  • Constructor Details

    • ManagementUtils

      public ManagementUtils()
  • Method Details

    • getAttribute

      public static Object getAttribute(MBeanServerConnection connection, String mbeanName, String attributeName) throws Exception
      Get the given attribute of the given mbean via the specified mbean server connection.
      Parameters:
      connection - the mbean server connection to use.
      mbeanName - the name of the mbean on which to invoke an attribute.
      attributeName - the name of the attribute to get.
      Returns:
      the value of the attrribute, or null if management is not available.
      Throws:
      Exception - if any error occurs.
    • isManagementAvailable

      public static boolean isManagementAvailable()
      Determine whether management is available for the current JVM.
      Returns:
      true if management is available, false otherwise.
    • getPlatformServer

      public static MBeanServer getPlatformServer()
      Get the platform MBean server.
      Returns:
      a MBeanServerObject.
    • isMBeanRegistered

      public static boolean isMBeanRegistered(String mbeanName) throws Exception
      Determine whether the MBean with the specified is already registered.
      Parameters:
      mbeanName - the name of the MBean to check.
      Returns:
      true if the MBean is registered, false otherwise.
      Throws:
      Exception - if any error occurs.
    • isMBeanRegistered

      public static boolean isMBeanRegistered(String mbeanName, MBeanServer server) throws Exception
      Determine whether the MBean with the specified is already registered.
      Parameters:
      mbeanName - the name of the MBean to check.
      server - the MBean server to check.
      Returns:
      true if the MBean is registered, false otherwise.
      Throws:
      Exception - if any error occurs.
    • isCpuTimeEnabled

      public static boolean isCpuTimeEnabled()
      Whether CPU time measurement is enabled/supported.
      Returns:
      true if time measurement is enabled, false otherwise.
    • getThreadCpuTime

      public static long getThreadCpuTime(long threadID)
      Determien the CPU time for the specified thread.
      Parameters:
      threadID - the id of the thread.
      Returns:
      the CPU time in nanoseconds, or -1L if the cpu time is not supported or could not be measured.
    • getThreadUserTime

      public static long getThreadUserTime(long threadID)
      Determien the user time for the specified thread.
      Parameters:
      threadID - the id of the thread.
      Returns:
      the user time in nanoseconds, or -1L if the user time is not supported or could not be measured.