Collect thread dumps of all Java process on localhost

Keimpe Bronkhorst keimpe.bronkhorst at oracle.com
Wed Nov 4 22:32:49 UTC 2015


This concerns code we have in Oracle JDeveloper which collect thread 
dumps of all Java Processes on local host. This code uses the non-public 
JDK classes:
      import sun.jvmstat.monitor.MonitorException;
      import sun.jvmstat.monitor.MonitoredHost;
      import sun.jvmstat.monitor.MonitoredVm;
      import sun.jvmstat.monitor.MonitoredVmUtil;
      import sun.jvmstat.monitor.VmIdentifier;

to identify the Java processes on local host, and

      import com.sun.tools.attach.VirtualMachine;
      import sun.tools.attach.HotSpotVirtualMachine;

to attach to the processes and dump their threads.

The trouble is that these classes are not accessible anymore in JDK9 
unless -XaddExports: is used.

Does anybody know how to do this functionality using public classes, or 
are there plans to add public classes to replace these non-public classes?

Keimpe Bronkhorst
Oracle JDeveloper




More information about the serviceability-dev mailing list