Package com.sun.management

Examples of com.sun.management.HotSpotDiagnosticMXBean.dumpHeap()


        OutputStream out = null;
        try {
            MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
            HotSpotDiagnosticMXBean diagnosticMXBean = ManagementFactory.newPlatformMXBeanProxy(mBeanServer,
                    "com.sun.management:type=HotSpotDiagnostic", HotSpotDiagnosticMXBean.class);
            diagnosticMXBean.dumpHeap("heapdump.txt", false);
            // copy the dump in the destination
            File heapDumpFile = new File("heapdump.txt");
            in = new FileInputStream(heapDumpFile);
            out = destination.add("heapdump.txt");
            byte[] buffer = new byte[2048];
View Full Code Here


            MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
            HotSpotDiagnosticMXBean diagnosticMXBean = ManagementFactory.newPlatformMXBeanProxy(mBeanServer,
                    "com.sun.management:type=HotSpotDiagnostic", HotSpotDiagnosticMXBean.class);
            heapDumpFile = File.createTempFile("heapdump", ".txt");
            heapDumpFile.delete();
            diagnosticMXBean.dumpHeap(heapDumpFile.getAbsolutePath(), false);
            // copy the dump in the destination
            in = new FileInputStream(heapDumpFile);
            out = destination.add("heapdump.txt");
            byte[] buffer = new byte[2048];
            int l;
View Full Code Here

        try {
            bean = ManagementFactory.newPlatformMXBeanProxy(platformBean,
                                                            "com.sun.management:type=HotSpotDiagnostic",
                                                            HotSpotDiagnosticMXBean.class);
            deleteFile(heapName);
            bean.dumpHeap(heapName, false);
        } catch(Exception ex){
            ex.printStackTrace();
        }
    }
   
View Full Code Here

        OutputStream out = null;
        try {
            MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
            HotSpotDiagnosticMXBean diagnosticMXBean = ManagementFactory.newPlatformMXBeanProxy(mBeanServer,
                    "com.sun.management:type=HotSpotDiagnostic", HotSpotDiagnosticMXBean.class);
            diagnosticMXBean.dumpHeap("heapdump.txt", false);
            // copy the dump in the destination
            File heapDumpFile = new File("heapdump.txt");
            in = new FileInputStream(heapDumpFile);
            out = destination.add("heapdump.txt");
            byte[] buffer = new byte[2048];
View Full Code Here

      tmp=SystemUtil.getTempFile("hprof",false);
      path=tmp.getAbsolutePath();
    }
    try{
      // it only
      mxbean.dumpHeap(path, live);
    }
    finally{
      if(tmp!=null && tmp.exists()){
        tmp.moveTo(res);
      }
View Full Code Here

public class DumpHeap {
    public static void main(String[] argv) throws Exception {
         MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
         HotSpotDiagnosticMXBean dm = sun.management.ManagementFactory.getDiagnosticMXBean();
         System.out.println("Dumping to file: " + argv[0] + " ....");
         dm.dumpHeap(argv[0], true);
    }
}
View Full Code Here

            boolean live = (args.length == 2) && !args[1].isEmpty() && (args[1].equals("live") || args[1].equals("l"));
            new File("dumps").mkdir();
            String filename = "dumps/HeapDump" + (live ? "Live" : "") + "-" + new SimpleDateFormat("MMddHHmmss").format(System.currentTimeMillis()) + ".hprof";
            MBeanServer server = ManagementFactory.getPlatformMBeanServer();
            HotSpotDiagnosticMXBean bean = ManagementFactory.newPlatformMXBeanProxy(server, "com.sun.management:type=HotSpotDiagnostic", HotSpotDiagnosticMXBean.class);
            bean.dumpHeap(filename, live);
            sb.append("Heap dumped.\n");
          }
          catch (IOException e)
          {
            sb.append("Exception: " + e.getMessage() + "!\n");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.