Package org.gridkit.jvmtool

Examples of org.gridkit.jvmtool.MBeanGCMonitor


      try {
        MBeanServerConnection mserver = conn.getMServer();
       
        System.out.println("MBean server connected");
       
        MBeanGCMonitor rmon = new MBeanGCMonitor(mserver);
        MBeanGCMonitor pmon = new MBeanGCMonitor(mserver);
        final MBeanGCMonitor fmon = new MBeanGCMonitor(mserver);
       
        Thread freport = new Thread() {
          @Override
          public void run() {
            System.out.println("\nTotal");
            System.out.println(fmon.calculateStats());
          }         
        };

        Runtime.getRuntime().addShutdownHook(freport);

        long interval = 60000;
        long deadline = System.currentTimeMillis() + interval;
        System.out.println("Collecting GC stats ...");
        while(true) {
          while(System.currentTimeMillis() < deadline) {
            String report = rmon.reportCollection();
            if (report.length() > 0) {
              System.out.println(report);
            }
            Thread.sleep(50);
          }
          deadline += interval;
          System.out.println();
          System.out.println(pmon.calculateStats());
          System.out.println();
          pmon = new MBeanGCMonitor(mserver);
          if (System.in.available() > 0) {
            return;
          }
        }
      } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.gridkit.jvmtool.MBeanGCMonitor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.