Java Code Examples for java.lang.management.ManagementFactory#getPlatformMXBean()

The following examples show how to use java.lang.management.ManagementFactory#getPlatformMXBean() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HeapCommand.java    From LagMonitor with MIT License 6 votes vote down vote up
private void onDump(CommandSender sender) {
    try {
        //test if this class is available
        Class.forName("com.sun.management.HotSpotDiagnosticMXBean");

        //can be useful for dumping heaps in binary format
        HotSpotDiagnosticMXBean hostSpot = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);

        Path dumpFile = getNewDumpFile();
        hostSpot.dumpHeap(dumpFile.toAbsolutePath().toString(), DUMP_DEAD_OBJECTS);

        sender.sendMessage(ChatColor.GRAY + "Dump created: " + dumpFile.getFileName());
        sender.sendMessage(ChatColor.GRAY + "You can analyse it using VisualVM");
    } catch (ClassNotFoundException notFoundEx) {
        sendError(sender, NOT_ORACLE_MSG);
    } catch (Exception ex) {
        plugin.getLogger().log(Level.SEVERE, null, ex);
        sendError(sender, "An exception occurred. Please check the server log");
    }
}
 
Example 2
Source File: PlatformLoggingMXBeanTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] argv) throws Exception {
    PlatformLoggingMXBean mbean =
        ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class);
    ObjectName objname = mbean.getObjectName();
    if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) {
        throw new RuntimeException("Invalid ObjectName " + objname);
    }

    // check if the PlatformLoggingMXBean is registered in the platform MBeanServer
    MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer();
    ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME);

    // We could call mbs.isRegistered(objName) here.
    // Calling getMBeanInfo will throw exception if not found.
    platformMBS.getMBeanInfo(objName);

    if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") ||
        !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) {
        throw new RuntimeException(objName + " is of unexpected type");
    }

    // test if PlatformLoggingMXBean works properly in a MBeanServer
    PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest();
    test.runTest(mbean);
}
 
Example 3
Source File: PlatformLoggingMXBeanTest.java    From native-obfuscator with GNU General Public License v3.0 6 votes vote down vote up
public static void main(String[] argv) throws Exception {
    PlatformLoggingMXBean mbean =
        ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class);
    ObjectName objname = mbean.getObjectName();
    if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) {
        throw new RuntimeException("Invalid ObjectName " + objname);
    }

    // check if the PlatformLoggingMXBean is registered in the platform MBeanServer
    MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer();
    ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME);

    // We could call mbs.isRegistered(objName) here.
    // Calling getMBeanInfo will throw exception if not found.
    platformMBS.getMBeanInfo(objName);

    if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") ||
        !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) {
        throw new RuntimeException(objName + " is of unexpected type");
    }

    // test if PlatformLoggingMXBean works properly in a MBeanServer
    PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest();
    test.runTest(mbean);
}
 
Example 4
Source File: VMOptionOpenDataTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String... args) throws Exception {
    MBeanServerConnection msc = ManagementFactory.getPlatformMBeanServer();
    HotSpotDiagnosticMXBean mxbean =
        ManagementFactory.getPlatformMXBean(msc, HotSpotDiagnosticMXBean.class);


    String[] signatures = new String[] {
        String.class.getName()
    };
    Object obj = msc.invoke(mxbean.getObjectName(), "getVMOption",
        new String[] { "PrintVMOptions"}, signatures);

    CompositeData data = (CompositeData)obj;
    validateType(data);

    VMOption option = mxbean.getVMOption("PrintVMOptions");
    VMOption o = VMOption.from(data);
    assertEquals(option, o);
}
 
Example 5
Source File: PlatformLoggingMXBeanTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] argv) throws Exception {
    PlatformLoggingMXBean mbean =
        ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class);
    ObjectName objname = mbean.getObjectName();
    if (!objname.equals(new ObjectName(LogManager.LOGGING_MXBEAN_NAME))) {
        throw new RuntimeException("Invalid ObjectName " + objname);
    }

    // check if the PlatformLoggingMXBean is registered in the platform MBeanServer
    MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer();
    ObjectName objName = new ObjectName(LogManager.LOGGING_MXBEAN_NAME);

    // We could call mbs.isRegistered(objName) here.
    // Calling getMBeanInfo will throw exception if not found.
    platformMBS.getMBeanInfo(objName);

    if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") ||
        !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) {
        throw new RuntimeException(objName + " is of unexpected type");
    }

    // test if PlatformLoggingMXBean works properly in a MBeanServer
    PlatformLoggingMXBeanTest test = new PlatformLoggingMXBeanTest();
    test.runTest(mbean);
}
 
Example 6
Source File: CpuMetric.java    From mdw with Apache License 2.0 5 votes vote down vote up
@Override
public List<Metric> collect() {
    if (osMxBean == null)
        osMxBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class);
    long process = Math.round(osMxBean.getProcessCpuLoad() * 100);
    long other = Math.round(osMxBean.getSystemCpuLoad() * 100) - process;
    List<Metric> metrics = new ArrayList<>();
    metrics.add(new Metric("jvm", "JVM", process));
    metrics.add(new Metric("other", "Other", other));
    return metrics;
}
 
Example 7
Source File: SystemStatusListener.java    From Sentinel with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
    try {
        OperatingSystemMXBean osBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class);
        currentLoad = osBean.getSystemLoadAverage();

        /*
         * Java Doc copied from {@link OperatingSystemMXBean#getSystemCpuLoad()}:</br>
         * Returns the "recent cpu usage" for the whole system. This value is a double in the [0.0,1.0] interval.
         * A value of 0.0 means that all CPUs were idle during the recent period of time observed, while a value
         * of 1.0 means that all CPUs were actively running 100% of the time during the recent period being
         * observed. All values between 0.0 and 1.0 are possible depending of the activities going on in the
         * system. If the system recent cpu usage is not available, the method returns a negative value.
         */
        double systemCpuUsage = osBean.getSystemCpuLoad();

        // calculate process cpu usage to support application running in container environment
        RuntimeMXBean runtimeBean = ManagementFactory.getPlatformMXBean(RuntimeMXBean.class);
        long newProcessCpuTime = osBean.getProcessCpuTime();
        long newProcessUpTime = runtimeBean.getUptime();
        int cpuCores = osBean.getAvailableProcessors();
        long processCpuTimeDiffInMs = TimeUnit.NANOSECONDS
                .toMillis(newProcessCpuTime - processCpuTime);
        long processUpTimeDiffInMs = newProcessUpTime - processUpTime;
        double processCpuUsage = (double) processCpuTimeDiffInMs / processUpTimeDiffInMs / cpuCores;
        processCpuTime = newProcessCpuTime;
        processUpTime = newProcessUpTime;

        currentCpuUsage = Math.max(processCpuUsage, systemCpuUsage);

        if (currentLoad > SystemRuleManager.getSystemLoadThreshold()) {
            writeSystemStatusLog();
        }
    } catch (Throwable e) {
        RecordLog.warn("[SystemStatusListener] Failed to get system metrics from JMX", e);
    }
}
 
Example 8
Source File: TestUseCompressedOopsErgoTools.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static long getCompressedClassSpaceSize() {
  HotSpotDiagnosticMXBean diagnostic =
      ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);

  VMOption option = diagnostic.getVMOption("CompressedClassSpaceSize");
  return Long.parseLong(option.getValue());
}
 
Example 9
Source File: JvmMemoryMetrics.java    From apm-agent-java with Apache License 2.0 5 votes vote down vote up
void bindTo(final MetricRegistry registry) {
    final MemoryMXBean platformMXBean = ManagementFactory.getPlatformMXBean(MemoryMXBean.class);
    registry.add("jvm.memory.heap.used", Labels.EMPTY, new DoubleSupplier() {
        @Override
        public double get() {
            return platformMXBean.getHeapMemoryUsage().getUsed();
        }
    });
    registry.add("jvm.memory.heap.committed", Labels.EMPTY, new DoubleSupplier() {
        @Override
        public double get() {
            return platformMXBean.getHeapMemoryUsage().getCommitted();
        }
    });
    registry.add("jvm.memory.heap.max", Labels.EMPTY, new DoubleSupplier() {
        @Override
        public double get() {
            return platformMXBean.getHeapMemoryUsage().getMax();
        }
    });
    registry.add("jvm.memory.non_heap.used", Labels.EMPTY, new DoubleSupplier() {
        @Override
        public double get() {
            return platformMXBean.getNonHeapMemoryUsage().getUsed();
        }
    });
    registry.add("jvm.memory.non_heap.committed", Labels.EMPTY, new DoubleSupplier() {
        @Override
        public double get() {
            return platformMXBean.getNonHeapMemoryUsage().getCommitted();
        }
    });
    registry.add("jvm.memory.non_heap.max", Labels.EMPTY, new DoubleSupplier() {
        @Override
        public double get() {
            return platformMXBean.getNonHeapMemoryUsage().getMax();
        }
    });
}
 
Example 10
Source File: TestNotificationListener.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Throwable {
    ObjectName objectName = new ObjectName(FlightRecorderMXBean.MXBEAN_NAME);
    ManagementFactory.getPlatformMBeanServer().addNotificationListener(objectName, listener, null, null);
    FlightRecorderMXBean bean = ManagementFactory.getPlatformMXBean(FlightRecorderMXBean.class);

    long recId = bean.newRecording();
    bean.startRecording(recId);

    latch.await();
    System.out.println("Completed successfully");
}
 
Example 11
Source File: VMOptionCommand.java    From arthas with Apache License 2.0 5 votes vote down vote up
@Override
public void complete(Completion completion) {
    HotSpotDiagnosticMXBean hotSpotDiagnosticMXBean = ManagementFactory
                    .getPlatformMXBean(HotSpotDiagnosticMXBean.class);
    List<VMOption> diagnosticOptions = hotSpotDiagnosticMXBean.getDiagnosticOptions();
    List<String> names = new ArrayList<String>(diagnosticOptions.size());
    for (VMOption option : diagnosticOptions) {
        names.add(option.getName());
    }
    CompletionUtils.complete(completion, names);
}
 
Example 12
Source File: Utils.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns value of VM option.
 *
 * @param name option's name
 * @return value of option or {@code null}, if option doesn't exist
 * @throws NullPointerException if name is null
 */
public static String getVMOption(String name) {
    String result;
    HotSpotDiagnosticMXBean diagnostic
            = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
    result = diagnostic.getVMOption(name).getValue();
    return result;
}
 
Example 13
Source File: ContainerHealthMetricsService.java    From incubator-gobblin with Apache License 2.0 5 votes vote down vote up
public ContainerHealthMetricsService(Config config) {
  this.metricReportingInterval = ConfigUtils.getLong(config, CONTAINER_METRICS_SERVICE_REPORTING_INTERVAL_SECONDS, DEFAULT_CONTAINER_METRICS_REPORTING_INTERVAL);
  this.operatingSystemMXBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class);
  this.memoryMXBean = ManagementFactory.getMemoryMXBean();
  this.garbageCollectorMXBeans = ManagementFactory.getGarbageCollectorMXBeans();
  this.lastGcStats = new GcStats();
  this.currentGcStats = new GcStats();

  //Build all the gauges and register them with the metrics registry.
  List<ContextAwareGauge<Double>> systemMetrics = buildGaugeList();
  systemMetrics.forEach(metric -> RootMetricContext.get().register(metric));
}
 
Example 14
Source File: SetVMOption.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    mbean =
        ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);

    VMOption option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    if (option.getOrigin() != Origin.VM_CREATION) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: VM_CREATION");
    }
    if (!option.isWriteable()) {
        throw new RuntimeException("Expected " + PRINT_GC_DETAILS +
            " to be writeable");
    }

    // set VM option to a new value
    mbean.setVMOption(PRINT_GC_DETAILS, NEW_VALUE);

    option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(NEW_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + NEW_VALUE);
    }
    if (option.getOrigin() != Origin.MANAGEMENT) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: MANAGEMENT");
    }
    VMOption o = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (option.getOrigin() != o.getOrigin()) {
        throw new RuntimeException("Unmatched origin: " +
            option.getOrigin() + " expected: " + o.getOrigin());
    }
    if (option.isWriteable() != o.isWriteable()) {
        throw new RuntimeException("Unmatched writeable: " +
            option.isWriteable() + " expected: " + o.isWriteable());
    }

    // check if ManagementServer is not writeable
    List<VMOption> options = mbean.getDiagnosticOptions();
    VMOption mgmtServerOption = null;
    for (VMOption o1 : options) {
        if (o1.getName().equals(MANAGEMENT_SERVER)) {
             mgmtServerOption = o1;
             break;
        }
    }
    if (mgmtServerOption != null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
    mgmtServerOption = mbean.getVMOption(MANAGEMENT_SERVER);
    if (mgmtServerOption == null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should exist.");
    }
    if (mgmtServerOption.getOrigin() != Origin.DEFAULT) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should have the default value.");
    }
    if (mgmtServerOption.isWriteable()) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
}
 
Example 15
Source File: SetVMOption.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    mbean =
        ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);

    VMOption option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    if (option.getOrigin() != Origin.VM_CREATION) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: VM_CREATION");
    }
    if (!option.isWriteable()) {
        throw new RuntimeException("Expected " + PRINT_GC_DETAILS +
            " to be writeable");
    }

    // set VM option to a new value
    mbean.setVMOption(PRINT_GC_DETAILS, NEW_VALUE);

    option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(NEW_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + NEW_VALUE);
    }
    if (option.getOrigin() != Origin.MANAGEMENT) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: MANAGEMENT");
    }
    VMOption o = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (option.getOrigin() != o.getOrigin()) {
        throw new RuntimeException("Unmatched origin: " +
            option.getOrigin() + " expected: " + o.getOrigin());
    }
    if (option.isWriteable() != o.isWriteable()) {
        throw new RuntimeException("Unmatched writeable: " +
            option.isWriteable() + " expected: " + o.isWriteable());
    }

    // check if ManagementServer is not writeable
    List<VMOption> options = mbean.getDiagnosticOptions();
    VMOption mgmtServerOption = null;
    for (VMOption o1 : options) {
        if (o1.getName().equals(MANAGEMENT_SERVER)) {
             mgmtServerOption = o1;
             break;
        }
    }
    if (mgmtServerOption != null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
    mgmtServerOption = mbean.getVMOption(MANAGEMENT_SERVER);
    if (mgmtServerOption == null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should exist.");
    }
    if (mgmtServerOption.getOrigin() != Origin.DEFAULT) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should have the default value.");
    }
    if (mgmtServerOption.isWriteable()) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
}
 
Example 16
Source File: SetVMOption.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    mbean =
        ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);

    VMOption option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    if (option.getOrigin() != Origin.VM_CREATION) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: VM_CREATION");
    }
    if (!option.isWriteable()) {
        throw new RuntimeException("Expected " + PRINT_GC_DETAILS +
            " to be writeable");
    }

    // set VM option to a new value
    mbean.setVMOption(PRINT_GC_DETAILS, NEW_VALUE);

    option = findPrintGCDetailsOption();
    if (!option.getValue().equalsIgnoreCase(NEW_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + NEW_VALUE);
    }
    if (option.getOrigin() != Origin.MANAGEMENT) {
        throw new RuntimeException("Unexpected origin: " +
            option.getOrigin() + " expected: MANAGEMENT");
    }
    VMOption o = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (!option.getValue().equals(o.getValue())) {
        throw new RuntimeException("Unmatched value: " +
            option.getValue() + " expected: " + o.getValue());
    }
    if (option.getOrigin() != o.getOrigin()) {
        throw new RuntimeException("Unmatched origin: " +
            option.getOrigin() + " expected: " + o.getOrigin());
    }
    if (option.isWriteable() != o.isWriteable()) {
        throw new RuntimeException("Unmatched writeable: " +
            option.isWriteable() + " expected: " + o.isWriteable());
    }

    // check if ManagementServer is not writeable
    List<VMOption> options = mbean.getDiagnosticOptions();
    VMOption mgmtServerOption = null;
    for (VMOption o1 : options) {
        if (o1.getName().equals(MANAGEMENT_SERVER)) {
             mgmtServerOption = o1;
             break;
        }
    }
    if (mgmtServerOption != null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
    mgmtServerOption = mbean.getVMOption(MANAGEMENT_SERVER);
    if (mgmtServerOption == null) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should exist.");
    }
    if (mgmtServerOption.getOrigin() != Origin.DEFAULT) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " should have the default value.");
    }
    if (mgmtServerOption.isWriteable()) {
        throw new RuntimeException(MANAGEMENT_SERVER +
            " is not expected to be writeable");
    }
}
 
Example 17
Source File: DynamicVMOption.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates an instance of DynamicVMOption.
 *
 * @param name the VM option name
 */
public DynamicVMOption(String name) {
    this.name = name;
    mxBean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
}
 
Example 18
Source File: DynamicVMOption.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates an instance of DynamicVMOption.
 *
 * @param name the VM option name
 */
public DynamicVMOption(String name) {
    this.name = name;
    mxBean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
}
 
Example 19
Source File: DynamicVMOption.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates an instance of DynamicVMOption.
 *
 * @param name the VM option name
 */
public DynamicVMOption(String name) {
    this.name = name;
    mxBean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
}
 
Example 20
Source File: DynamicVMOption.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates an instance of DynamicVMOption.
 *
 * @param name the VM option name
 */
public DynamicVMOption(String name) {
    this.name = name;
    mxBean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
}