jmx基本使用

翻到了之前的JMX知识,看jmx能帮你采集哪些基本信息~

package com.test;
ackage com.ilucky.test.jvm.jmx.one;

import java.io.IOException;
import java.lang.management.ClassLoadingMXBean;
import java.lang.management.CompilationMXBean;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryManagerMXBean;
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryUsage;
import java.lang.management.OperatingSystemMXBean;
import java.lang.management.RuntimeMXBean;
import java.lang.management.ThreadMXBean;
import java.util.Arrays;
import java.util.List;
import java.util.Map.Entry;

import javax.management.MBeanServerConnection;
import javax.management.ObjectName;

/**
 * ManagementFactory基本使用
 * 
 * @author IluckySi
 *
 */
public class MBeanDemo {

    public static void main(String[] args) {
        visitMBean();
        
        showSystem();
        showJvmInfo();
        showMemoryInfo();
        showClassLoading();
        showCompilation();
        showThread();
        showGarbageCollector();
        showMemoryManager();
        showMemoryPool();
    }

    /** 访问 MXBean有三种方法 */
    public static void visitMBean() { 
        System.out.println("------visitMBean------");
        
        // 第一种: 直接调用Java虚拟机内的MXBean中的方法
        RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
        String vendor1 = mxbean.getVmVendor();
        System.out.println("vendor1:" +  vendor1); 
         
        //第二种: 通过一个连接到正在运行的虚拟机的平台MBeanServer的MBeanServerConnection
        MBeanServerConnection mbs = null; 
        try { 
            // Returns the platform MBeanServer. On the first call to this method, 
            // it first creates the platform MBeanServer by calling the MBeanServerFactory.createMBeanServer method 
            // and registers each platform MXBean in this platform MBeanServer with its ObjectName. 
            // This method, in subsequent calls, will simply return the initially created platform MBeanServer. 
            mbs = ManagementFactory.getPlatformMBeanServer();
            ObjectName on = new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
            String vendor2 = (String) mbs.getAttribute(on, "VmVendor");
            System.out.println("vendor2:" + vendor2); 
        } catch (Exception e) {
             e.printStackTrace(); 
        } 
                                       
        //第三种使用MXBean代理
        MBeanServerConnection mbs2 = null;
        RuntimeMXBean proxy = null;
        try {
            mbs2 = ManagementFactory.getPlatformMBeanServer();
            // Returns a proxy for a platform MXBean interface of a given MXBean name that forwards its method calls through the given MBeanServerConnection. 
            proxy = ManagementFactory.newPlatformMXBeanProxy(mbs2, ManagementFactory.RUNTIME_MXBEAN_NAME, RuntimeMXBean.class); 
            String vendor3 =  proxy.getVmVendor();
            System.out.println("vendor3:" + vendor3); 
        } catch (IOException e) {
            e.printStackTrace();
        } 
    }
    
    /** 操作系统信息 */
    public static void showSystem() {
        System.out.println("------getOperatingSystemMXBean------");
        
        OperatingSystemMXBean mxbean = ManagementFactory.getOperatingSystemMXBean();
        // Returns an ObjectName instance representing the object name of this platform managed object.
        System.out.println("getObjectName:" + mxbean.getObjectName());
        
        // Returns the operating system architecture. This method is equivalent to System.getProperty("os.arch").
        System.out.println("getArch: " + mxbean.getArch());
        // Returns the operating system name. This method is equivalent to System.getProperty("os.name").
        System.out.println("getName: " + mxbean.getName());
        // Returns the operating system version. This method is equivalent to System.getProperty("os.version").
        System.out.println("getName: " + mxbean.getName());
        // Returns the number of processors available to the Java virtual machine. This method is equivalent to the Runtime.availableProcessors() method. 
        System.out.println("getAvailableProcessors: " + mxbean.getAvailableProcessors());
        // Returns the system load average for the last minute. 
        System.out.println("getSystemLoadAverage: " + mxbean.getSystemLoadAverage());
    }
    
    /** Java虚拟机的运行时信息 */
    public static void showJvmInfo() {
        System.out.println("------getRuntimeMXBean------");
        
        RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
        // Returns an ObjectName instance representing the object name of this platform managed object.
        System.out.println("getObjectName:" + mxbean.getObjectName());
        // Returns the name representing the running Java virtual machine.
        System.out.println("getName:" + mxbean.getName());
        
        // Returns the Java virtual machine implementation vendor. This method is equivalent to System.getProperty("java.vm.vendor").
        System.out.println("getVmVendor:" + mxbean.getVmVendor());
        // Returns the Java virtual machine implementation name. This method is equivalent to System.getProperty("java.vm.name").
        System.out.println("getVmName:" + mxbean.getVmName());
        // Returns the Java virtual machine implementation name. This method is equivalent to System.getProperty("java.vm.name").
        System.out.println("getVmVersion:" + mxbean.getVmVersion());
        
        // Returns the Java virtual machine specification vendor. This method is equivalent to System.getProperty("java.vm.specification.vendor").
        System.out.println("getSpecVendor:" + mxbean.getSpecVendor());
        // Returns the Java virtual machine specification name. This method is equivalent to System.getProperty("java.vm.specification.name").
        System.out.println("getSpecName:" + mxbean.getSpecName());
        // Returns the Java virtual machine specification version. This method is equivalent to System.getProperty("java.vm.specification.version").
        System.out.println("getSpecVersion:" + mxbean.getSpecVersion());
        // Returns the version of the specification for the management interface implemented by the running Java virtual machine.
        System.out.println("getManagementSpecVersion:" + mxbean.getManagementSpecVersion());
        
        // Returns the boot class path that is used by the bootstrap class loader to search for class files. 
        System.out.println("getBootClassPath:" + mxbean.getBootClassPath());
        // Tests if the Java virtual machine supports the boot class path mechanism used by the bootstrap class loader to search for class files.
        System.out.println("isBootClassPathSupported:" + mxbean.isBootClassPathSupported());
        // Returns the Java library path. This method is equivalent to System.getProperty("java.library.path"). 
        System.out.println("getLibraryPath:" + mxbean.getLibraryPath());
        
        // Returns the start time of the Java virtual machine in milliseconds. This method returns the approximate time when the Java virtual machine started
        System.out.println("getStartTime:" + mxbean.getStartTime());
        // Returns the uptime of the Java virtual machine in milliseconds.
        System.out.println("getUptime:" + mxbean.getUptime());
        // Returns the input arguments passed to the Java virtual machine which does not include the arguments to the main method. This method returns an empty list if there is no input argument to the Java virtual machine. 
        System.out.println("getInputArguments:" + mxbean.getInputArguments());
        
        // Returns a map of names and values of all system properties. This method calls System.getProperties to get all system properties. Properties whose name or value is not a String are omitted. 
        System.out.println("getSystemProperties:" + mxbean.getSystemProperties());
        for(Entry<String, String> entry: mxbean.getSystemProperties().entrySet()) {
            System.out.println("getSystemProperties:" + entry.getKey() + "-" + entry.getValue());
        }
    }

    /** Java 虚拟机的内存信息 */
    public static void showMemoryInfo() {
        System.out.println("------getMemoryMXBean------");
        
        MemoryMXBean mxbean = ManagementFactory.getMemoryMXBean();
        // Returns an ObjectName instance representing the object name of this platform managed object.
        System.out.println("getObjectName:" + mxbean.getObjectName());
        
        // Returns the current memory usage of the heap that is used for object allocation. The heap consists of one or more memory pools. 
        MemoryUsage heap = mxbean.getHeapMemoryUsage();
        // Returns the amount of memory in bytes that is committed for the Java virtual machine to use. 
        System.out.println("getCommitted:" + heap.getCommitted());
        // Returns the amount of memory in bytes that the Java virtual machine initially requests from the operating system for memory management.
        System.out.println("getInit:" + heap.getInit());
        // Returns the maximum amount of memory in bytes that can be used for memory management. This method returns -1 if the maximum memory size is undefined. 
        System.out.println("getMax:" + heap.getMax());
        // Returns the amount of used memory in bytes.
        System.out.println("getUsed:" + heap.getUsed());
    }

    /** Java 虚拟机的类加载信息 */
    public static void showClassLoading() {
        System.out.println("------getClassLoadingMXBean------");
        
        ClassLoadingMXBean mxbean = ManagementFactory.getClassLoadingMXBean();
        // Returns an ObjectName instance representing the object name of this platform managed object.
        System.out.println("getObjectName:" + mxbean.getObjectName());
        
        // Returns the total number of classes that have been loaded since the Java virtual machine has started execution.
        System.out.println("TotalLoadedClassCount: " + mxbean.getTotalLoadedClassCount());
        // Returns the number of classes that are currently loaded in the Java virtual machine.
        System.out.println("LoadedClassCount" + mxbean.getLoadedClassCount());
        // Returns the total number of classes unloaded since the Java virtual machine has started execution
        System.out.println("UnloadedClassCount:" + mxbean.getUnloadedClassCount());
    }

    /** Java 虚拟机的编译信息 */
    public static void showCompilation() {
        System.out.println("------getCompilationMXBean------");
        
        CompilationMXBean mxbean = ManagementFactory.getCompilationMXBean();
        // Returns an ObjectName instance representing the object name of this platform managed object.
        System.out.println("getObjectName:" + mxbean.getObjectName());
        
        // Returns the approximate accumulated elapsed time (in milliseconds) spent in compilation.
        System.out.println("getTotalCompilationTime:" + mxbean.getTotalCompilationTime());
        // Returns the name of the Just-in-time (JIT) compiler.
        System.out.println("getName:" + mxbean.getName());
        // Tests if the Java virtual machine supports the monitoring of compilation time.
        System.out.println("isCompilationTimeMonitoringSupported:" + mxbean.isCompilationTimeMonitoringSupported());
    }

    /** Java 虚拟机的线程信息 */
    public static void showThread() {
        System.out.println("------getThreadMXBean------");
        
        ThreadMXBean mxbean = ManagementFactory.getThreadMXBean();
        // Returns an ObjectName instance representing the object name of this platform managed object.
        System.out.println("getObjectName:" + mxbean.getObjectName());
        
        // Returns all live thread IDs. Some threads included in the returned array may have been terminated when this method returns.
        System.out.println("getAllThreadIds:" + Arrays.toString(mxbean.getAllThreadIds()));
        // Returns the current number of live threads including both daemon and non-daemon threads.
        System.out.println("ThreadCount: " + mxbean.getThreadCount());
        // Returns the current number of live daemon threads.
        System.out.println("DaemonThreadCount: " + mxbean.getDaemonThreadCount());
        // Returns the peak live thread count since the Java virtual machine started or peak was reset.
        System.out.println("PeakThreadCount:" + mxbean.getPeakThreadCount());
        // Returns the total number of threads created and also started since the Java virtual machine started.
        System.out.println("TotalStartedThreadCount:" + mxbean.getTotalStartedThreadCount());
        
        // Returns the CPU time that the current thread has executed in user mode in nanoseconds.
        System.out.println("CurrentThreadUserTime: " + mxbean.getCurrentThreadUserTime());
        
        System.out.println("getAllThreadIds:");
        for(long id : mxbean.getAllThreadIds()) {
            System.out.println("threadId: " + id);
            // Returns the total CPU time for a thread of the specified ID in nanoseconds.
            System.out.println("getThreadCpuTime: " + mxbean.getThreadCpuTime(id));
            // Returns the thread info for a thread of the specified id with no stack trace. This method is equivalent to calling: 
            // getThreadInfo(id, 0); 
            System.out.println("getThreadInfo: " + mxbean.getThreadInfo(id));
        }
    }

    /** Java 虚拟机中的垃圾回收器信息: 补充: 新生代收集器: Parallel Scavenge, 老年代选择器: Serial Old */
    public static void showGarbageCollector() {
        System.out.println("------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.
        List<GarbageCollectorMXBean> mxbean = ManagementFactory.getGarbageCollectorMXBeans();
        
        for (GarbageCollectorMXBean gc : mxbean) {
            // Returns an ObjectName instance representing the object name of this platform managed object.
            System.out.println("getObjectName:" + gc.getObjectName());
            // Returns the name representing this memory manager.
            System.out.println("getName:" + gc.getName());
            // Returns the total number of collections that have occurred. This method returns -1 if the collection count is undefined for this collector.
            System.out.println("getCollectionCount: " + gc.getCollectionCount());
            // Returns the approximate accumulated collection elapsed time in milliseconds. This method returns -1 if the collection elapsed time is undefined for this collector. 
            System.out.println("getCollectionTime: " + gc.getCollectionTime());
            // Returns the name of memory pools that this memory manager manages.
            System.out.println("getMemoryPoolNames: " + Arrays.toString(gc.getMemoryPoolNames()));
        }
    }

    /** Java 虚拟机中的内存管理器 */
    public static void showMemoryManager() {
        System.out.println("------getMemoryManagerMXBeans------");
        
        List<MemoryManagerMXBean> mxbean = ManagementFactory.getMemoryManagerMXBeans();
        for (MemoryManagerMXBean mm : mxbean) {
            // Returns an ObjectName instance representing the object name of this platform managed object.
            System.out.println("getObjectName:" + mm.getObjectName());
            System.out.println("getName:" + mm.getName());
            // Returns the name of memory pools that this memory manager manages.
            System.out.println("getMemoryPoolNames:" + Arrays.toString(mm.getMemoryPoolNames()));
        }
    }

    /** * Java 虚拟机中的内存池 */
    public static void showMemoryPool() {
        System.out.println("------getMemoryPoolMXBeans------");
        
        List<MemoryPoolMXBean> mps = ManagementFactory.getMemoryPoolMXBeans();
        for (MemoryPoolMXBean mp : mps) {
            // Returns an ObjectName instance representing the object name of this platform managed object.
            System.out.println("object name:" + mp.getObjectName());
            System.out.println("name:" + mp.getName());
            // Returns the type of this memory pool. 
            System.out.println("type:" + mp.getType());
            // Returns an estimate of the memory usage of this memory pool. 
            System.out.println("getUsage:" + mp.getUsage());
            // Returns the usage threshold value of this memory pool in bytes. 
            // System.out.println("getUsageThreshold:" + mp.getUsageThreshold());
            // Returns the number of times that the memory usage has crossed the usage threshold.
            // System.out.println("getUsageThresholdCount:" + mp.getUsageThresholdCount());
            // Returns the memory usage after the Java virtual machine most recently expended effort in recycling unused objects in this memory pool. 
            System.out.println("CollectionUsage:" + mp.getCollectionUsage());
            
            // 执行如下代码报错: java.lang.UnsupportedOperationException: CollectionUsage threshold is not supported
            // System.out.println("getCollectionUsageThreshold:" + mp.getCollectionUsageThreshold());
            // System.out.println("getCollectionUsageThresholdCount:" + mp.getCollectionUsageThresholdCount());
        }
    }
}
/**
------visitMBean------
vendor1:Oracle Corporation
vendor2:Oracle Corporation
vendor3:Oracle Corporation
------getOperatingSystemMXBean------
getObjectName:java.lang:type=OperatingSystem
getArch: amd64
getName: Windows 7
getName: Windows 7
getAvailableProcessors: 4
getSystemLoadAverage: -1.0
------getRuntimeMXBean------
getObjectName:java.lang:type=Runtime
getName:8420@USER-8S7V892FFI
getVmVendor:Oracle Corporation
getVmName:Java HotSpot(TM) 64-Bit Server VM
getVmVersion:25.121-b13
getSpecVendor:Oracle Corporation
getSpecName:Java Virtual Machine Specification
getSpecVersion:1.8
getManagementSpecVersion:1.2
getBootClassPath:E:\software\jdk\jdk8\jre\lib\resources.jar;E:\software\jdk\jdk8\jre\lib\rt.jar;E:\software\jdk\jdk8\jre\lib\sunrsasign.jar;E:\software\jdk\jdk8\jre\lib\jsse.jar;E:\software\jdk\jdk8\jre\lib\jce.jar;E:\software\jdk\jdk8\jre\lib\charsets.jar;E:\software\jdk\jdk8\jre\lib\jfr.jar;E:\software\jdk\jdk8\jre\classes
isBootClassPathSupported:true
getLibraryPath:E:\software\jdk\jdk8\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;E:/software/jdk/jdk8/bin/../jre/bin/server;E:/software/jdk/jdk8/bin/../jre/bin;E:/software/jdk/jdk8/bin/../jre/lib/amd64;D:\software\jboss\jboss-eap-6.2\bin;E:\software\jdk\jdk8\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;E:\software\maven\apache-maven-3.5.0\bin;C:\Program Files (x86)\Lenovo\Access Connections\;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program Files (x86)\OpenVPN\bin;E:\software\eclipse\eclipse;;.
getStartTime:1538118655006
getUptime:1150
getInputArguments:[-Dfile.encoding=UTF-8]
getSystemProperties:{sun.desktop=windows, awt.toolkit=sun.awt.windows.WToolkit, file.encoding.pkg=sun.io, java.specification.version=1.8, sun.cpu.isalist=amd64, sun.jnu.encoding=GBK, java.class.path=D:\core\git2018\ilucky-java-test\ilucky-test-jvm\target\classes;D:\core\git2018\ilucky-java-test\ilucky-test-jvm-classloader-tomcat\target\classes, java.vm.vendor=Oracle Corporation, sun.arch.data.model=64, user.variant=, java.vendor.url=http://java.oracle.com/, user.timezone=, os.name=Windows 7, java.vm.specification.version=1.8, user.country=CN, sun.java.launcher=SUN_STANDARD, sun.boot.library.path=E:\software\jdk\jdk8\jre\bin, sun.java.command=com.ilucky.test.jvm.jmx.one.MBeanDemo, sun.cpu.endian=little, user.home=C:\Users\IluckySi, user.language=zh, java.specification.vendor=Oracle Corporation, java.home=E:\software\jdk\jdk8\jre, file.separator=\, line.separator=
, java.vm.specification.vendor=Oracle Corporation, java.specification.name=Java Platform API Specification, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, sun.boot.class.path=E:\software\jdk\jdk8\jre\lib\resources.jar;E:\software\jdk\jdk8\jre\lib\rt.jar;E:\software\jdk\jdk8\jre\lib\sunrsasign.jar;E:\software\jdk\jdk8\jre\lib\jsse.jar;E:\software\jdk\jdk8\jre\lib\jce.jar;E:\software\jdk\jdk8\jre\lib\charsets.jar;E:\software\jdk\jdk8\jre\lib\jfr.jar;E:\software\jdk\jdk8\jre\classes, user.script=, sun.management.compiler=HotSpot 64-Bit Tiered Compilers, java.runtime.version=1.8.0_121-b13, user.name=IluckySi, path.separator=;, os.version=6.1, java.endorsed.dirs=E:\software\jdk\jdk8\jre\lib\endorsed, java.runtime.name=Java(TM) SE Runtime Environment, file.encoding=UTF-8, java.vm.name=Java HotSpot(TM) 64-Bit Server VM, java.vendor.url.bug=http://bugreport.sun.com/bugreport/, java.io.tmpdir=C:\Users\IluckySi\AppData\Local\Temp\, java.version=1.8.0_121, user.dir=D:\core\git2018\ilucky-java-test\ilucky-test-jvm, os.arch=amd64, java.vm.specification.name=Java Virtual Machine Specification, java.awt.printerjob=sun.awt.windows.WPrinterJob, sun.os.patch.level=Service Pack 1, java.library.path=E:\software\jdk\jdk8\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;E:/software/jdk/jdk8/bin/../jre/bin/server;E:/software/jdk/jdk8/bin/../jre/bin;E:/software/jdk/jdk8/bin/../jre/lib/amd64;D:\software\jboss\jboss-eap-6.2\bin;E:\software\jdk\jdk8\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;E:\software\maven\apache-maven-3.5.0\bin;C:\Program Files (x86)\Lenovo\Access Connections\;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program Files (x86)\OpenVPN\bin;E:\software\eclipse\eclipse;;., java.vm.info=mixed mode, java.vendor=Oracle Corporation, java.vm.version=25.121-b13, java.ext.dirs=E:\software\jdk\jdk8\jre\lib\ext;C:\Windows\Sun\Java\lib\ext, sun.io.unicode.encoding=UnicodeLittle, java.class.version=52.0}
getSystemProperties:sun.desktop-windows
getSystemProperties:awt.toolkit-sun.awt.windows.WToolkit
getSystemProperties:file.encoding.pkg-sun.io
getSystemProperties:java.specification.version-1.8
getSystemProperties:sun.cpu.isalist-amd64
getSystemProperties:sun.jnu.encoding-GBK
getSystemProperties:java.class.path-D:\core\git2018\ilucky-java-test\ilucky-test-jvm\target\classes;D:\core\git2018\ilucky-java-test\ilucky-test-jvm-classloader-tomcat\target\classes
getSystemProperties:java.vm.vendor-Oracle Corporation
getSystemProperties:sun.arch.data.model-64
getSystemProperties:user.variant-
getSystemProperties:java.vendor.url-http://java.oracle.com/
getSystemProperties:user.timezone-
getSystemProperties:os.name-Windows 7
getSystemProperties:java.vm.specification.version-1.8
getSystemProperties:user.country-CN
getSystemProperties:sun.java.launcher-SUN_STANDARD
getSystemProperties:sun.boot.library.path-E:\software\jdk\jdk8\jre\bin
getSystemProperties:sun.java.command-com.ilucky.test.jvm.jmx.one.MBeanDemo
getSystemProperties:sun.cpu.endian-little
getSystemProperties:user.home-C:\Users\IluckySi
getSystemProperties:user.language-zh
getSystemProperties:java.specification.vendor-Oracle Corporation
getSystemProperties:java.home-E:\software\jdk\jdk8\jre
getSystemProperties:file.separator-\
getSystemProperties:line.separator-

getSystemProperties:java.vm.specification.vendor-Oracle Corporation
getSystemProperties:java.specification.name-Java Platform API Specification
getSystemProperties:java.awt.graphicsenv-sun.awt.Win32GraphicsEnvironment
getSystemProperties:sun.boot.class.path-E:\software\jdk\jdk8\jre\lib\resources.jar;E:\software\jdk\jdk8\jre\lib\rt.jar;E:\software\jdk\jdk8\jre\lib\sunrsasign.jar;E:\software\jdk\jdk8\jre\lib\jsse.jar;E:\software\jdk\jdk8\jre\lib\jce.jar;E:\software\jdk\jdk8\jre\lib\charsets.jar;E:\software\jdk\jdk8\jre\lib\jfr.jar;E:\software\jdk\jdk8\jre\classes
getSystemProperties:user.script-
getSystemProperties:sun.management.compiler-HotSpot 64-Bit Tiered Compilers
getSystemProperties:java.runtime.version-1.8.0_121-b13
getSystemProperties:user.name-IluckySi
getSystemProperties:path.separator-;
getSystemProperties:os.version-6.1
getSystemProperties:java.endorsed.dirs-E:\software\jdk\jdk8\jre\lib\endorsed
getSystemProperties:java.runtime.name-Java(TM) SE Runtime Environment
getSystemProperties:file.encoding-UTF-8
getSystemProperties:java.vm.name-Java HotSpot(TM) 64-Bit Server VM
getSystemProperties:java.vendor.url.bug-http://bugreport.sun.com/bugreport/
getSystemProperties:java.io.tmpdir-C:\Users\IluckySi\AppData\Local\Temp\
getSystemProperties:java.version-1.8.0_121
getSystemProperties:user.dir-D:\core\git2018\ilucky-java-test\ilucky-test-jvm
getSystemProperties:os.arch-amd64
getSystemProperties:java.vm.specification.name-Java Virtual Machine Specification
getSystemProperties:java.awt.printerjob-sun.awt.windows.WPrinterJob
getSystemProperties:sun.os.patch.level-Service Pack 1
getSystemProperties:java.library.path-E:\software\jdk\jdk8\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;E:/software/jdk/jdk8/bin/../jre/bin/server;E:/software/jdk/jdk8/bin/../jre/bin;E:/software/jdk/jdk8/bin/../jre/lib/amd64;D:\software\jboss\jboss-eap-6.2\bin;E:\software\jdk\jdk8\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;E:\software\maven\apache-maven-3.5.0\bin;C:\Program Files (x86)\Lenovo\Access Connections\;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program Files (x86)\OpenVPN\bin;E:\software\eclipse\eclipse;;.
getSystemProperties:java.vm.info-mixed mode
getSystemProperties:java.vendor-Oracle Corporation
getSystemProperties:java.vm.version-25.121-b13
getSystemProperties:java.ext.dirs-E:\software\jdk\jdk8\jre\lib\ext;C:\Windows\Sun\Java\lib\ext
getSystemProperties:sun.io.unicode.encoding-UnicodeLittle
getSystemProperties:java.class.version-52.0
------getMemoryMXBean------
getObjectName:java.lang:type=Memory
getCommitted:96468992
getInit:100663296
getMax:1405616128
getUsed:3028752
------getClassLoadingMXBean------
getObjectName:java.lang:type=ClassLoading
TotalLoadedClassCount: 870
LoadedClassCount870
UnloadedClassCount:0
------getCompilationMXBean------
getObjectName:java.lang:type=Compilation
getTotalCompilationTime:76
getName:HotSpot 64-Bit Tiered Compilers
isCompilationTimeMonitoringSupported:true
------getThreadMXBean------
getObjectName:java.lang:type=Threading
getAllThreadIds:[5, 4, 3, 2, 1]
ThreadCount: 5
DaemonThreadCount: 4
PeakThreadCount:5
TotalStartedThreadCount:5
CurrentThreadUserTime: 249601600
getAllThreadIds:
threadId: 5
getThreadCpuTime: 0
getThreadInfo: "Attach Listener" Id=5 RUNNABLE


threadId: 4
getThreadCpuTime: 0
getThreadInfo: "Signal Dispatcher" Id=4 RUNNABLE


threadId: 3
getThreadCpuTime: 0
getThreadInfo: "Finalizer" Id=3 WAITING on java.lang.ref.ReferenceQueue$Lock@7ef20235


threadId: 2
getThreadCpuTime: 0
getThreadInfo: "Reference Handler" Id=2 WAITING on java.lang.ref.Reference$Lock@27d6c5e0


threadId: 1
getThreadCpuTime: 280801800
getThreadInfo: "main" Id=1 RUNNABLE


------getGarbageCollectorMXBeans------
getObjectName:java.lang:type=GarbageCollector,name=PS Scavenge
getName:PS Scavenge
getCollectionCount: 0
getCollectionTime: 0
getMemoryPoolNames: [PS Eden Space, PS Survivor Space]
getObjectName:java.lang:type=GarbageCollector,name=PS MarkSweep
getName:PS MarkSweep
getCollectionCount: 0
getCollectionTime: 0
getMemoryPoolNames: [PS Eden Space, PS Survivor Space, PS Old Gen]
------getMemoryManagerMXBeans------
getObjectName:java.lang:type=MemoryManager,name=CodeCacheManager
getName:CodeCacheManager
getMemoryPoolNames:[Code Cache]
getObjectName:java.lang:type=MemoryManager,name=Metaspace Manager
getName:Metaspace Manager
getMemoryPoolNames:[Metaspace, Compressed Class Space]
getObjectName:java.lang:type=GarbageCollector,name=PS Scavenge
getName:PS Scavenge
getMemoryPoolNames:[PS Eden Space, PS Survivor Space]
getObjectName:java.lang:type=GarbageCollector,name=PS MarkSweep
getName:PS MarkSweep
getMemoryPoolNames:[PS Eden Space, PS Survivor Space, PS Old Gen]
------getMemoryPoolMXBeans------
object name:java.lang:type=MemoryPool,name=Code Cache
name:Code Cache
type:Non-heap memory
getUsage:init = 2555904(2496K) used = 1539904(1503K) committed = 2555904(2496K) max = 251658240(245760K)
CollectionUsage:null
object name:java.lang:type=MemoryPool,name=Metaspace
name:Metaspace
type:Non-heap memory
getUsage:init = 0(0K) used = 5070568(4951K) committed = 5373952(5248K) max = -1(-1K)
CollectionUsage:null
object name:java.lang:type=MemoryPool,name=Compressed Class Space
name:Compressed Class Space
type:Non-heap memory
getUsage:init = 0(0K) used = 596120(582K) committed = 655360(640K) max = 1073741824(1048576K)
CollectionUsage:null
object name:java.lang:type=MemoryPool,name=PS Eden Space
name:PS Eden Space
type:Heap memory
getUsage:init = 25165824(24576K) used = 3028752(2957K) committed = 25165824(24576K) max = 518520832(506368K)
CollectionUsage:init = 25165824(24576K) used = 0(0K) committed = 0(0K) max = 518520832(506368K)
object name:java.lang:type=MemoryPool,name=PS Survivor Space
name:PS Survivor Space
type:Heap memory
getUsage:init = 4194304(4096K) used = 0(0K) committed = 4194304(4096K) max = 4194304(4096K)
CollectionUsage:init = 4194304(4096K) used = 0(0K) committed = 0(0K) max = 4194304(4096K)
object name:java.lang:type=MemoryPool,name=PS Old Gen
name:PS Old Gen
type:Heap memory
getUsage:init = 67108864(65536K) used = 0(0K) committed = 67108864(65536K) max = 1054343168(1029632K)
CollectionUsage:init = 67108864(65536K) used = 0(0K) committed = 0(0K) max = 1054343168(1029632K)
*/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值