Java Code Examples for sun.tools.attach.HotSpotVirtualMachine#remoteDataDump()
The following examples show how to use
sun.tools.attach.HotSpotVirtualMachine#remoteDataDump() .
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: PidExecutorTest.java From bistoury with GNU General Public License v3.0 | 5 votes |
private static String readJStackOutput(HotSpotVirtualMachine hotSpotVirtualMachine) throws IOException { // byte[] bytes = ByteStreams.toByteArray(hotSpotVirtualMachine.remoteDataDump(new String[0])); // return new String(bytes, Charsets.UTF_8); try (InputStream inputStream = hotSpotVirtualMachine.remoteDataDump(new String[0])) { byte[] bytes = ByteStreams.toByteArray(inputStream); return new String(bytes, Charsets.UTF_8); } }
Example 2
Source File: AttachWithStalePidFile.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static boolean runTest() throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+PauseAtStartup", "AttachWithStalePidFileTarget"); Process target = pb.start(); Path pidFile = null; try { int pid = getUnixProcessId(target); // create the stale .java_pid file. use hard-coded /tmp path as in th VM pidFile = createJavaPidFile(pid); if(pidFile == null) { return false; } // wait for vm.paused file to be created and delete it once we find it. waitForAndResumeVM(pid); // unfortunately there's no reliable way to know the VM is ready to receive the // attach request so we have to do an arbitrary sleep. Thread.sleep(5000); HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(((Integer)pid).toString()); BufferedReader remoteDataReader = new BufferedReader(new InputStreamReader(vm.remoteDataDump())); String line = null; while((line = remoteDataReader.readLine()) != null); vm.detach(); return true; } finally { target.destroy(); target.waitFor(); if(pidFile != null && Files.exists(pidFile)) { Files.delete(pidFile); } } }
Example 3
Source File: AttachWithStalePidFile.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static boolean runTest() throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+PauseAtStartup", "AttachWithStalePidFileTarget"); Process target = pb.start(); Path pidFile = null; try { int pid = getUnixProcessId(target); // create the stale .java_pid file. use hard-coded /tmp path as in th VM pidFile = createJavaPidFile(pid); if(pidFile == null) { return false; } // wait for vm.paused file to be created and delete it once we find it. waitForAndResumeVM(pid); // unfortunately there's no reliable way to know the VM is ready to receive the // attach request so we have to do an arbitrary sleep. Thread.sleep(5000); HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(((Integer)pid).toString()); BufferedReader remoteDataReader = new BufferedReader(new InputStreamReader(vm.remoteDataDump())); String line = null; while((line = remoteDataReader.readLine()) != null); vm.detach(); return true; } finally { target.destroy(); target.waitFor(); if(pidFile != null && Files.exists(pidFile)) { Files.delete(pidFile); } } }
Example 4
Source File: AttachWithStalePidFile.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static boolean runTest() throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+PauseAtStartup", "AttachWithStalePidFileTarget"); Process target = pb.start(); Path pidFile = null; try { int pid = getUnixProcessId(target); // create the stale .java_pid file. use hard-coded /tmp path as in th VM pidFile = createJavaPidFile(pid); if(pidFile == null) { return false; } // wait for vm.paused file to be created and delete it once we find it. waitForAndResumeVM(pid); // unfortunately there's no reliable way to know the VM is ready to receive the // attach request so we have to do an arbitrary sleep. Thread.sleep(5000); HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(((Integer)pid).toString()); BufferedReader remoteDataReader = new BufferedReader(new InputStreamReader(vm.remoteDataDump())); String line = null; while((line = remoteDataReader.readLine()) != null); vm.detach(); return true; } finally { target.destroy(); target.waitFor(); if(pidFile != null && Files.exists(pidFile)) { Files.delete(pidFile); } } }
Example 5
Source File: AttachWithStalePidFile.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static boolean runTest() throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+PauseAtStartup", "AttachWithStalePidFileTarget"); Process target = pb.start(); Path pidFile = null; try { int pid = getUnixProcessId(target); // create the stale .java_pid file. use hard-coded /tmp path as in th VM pidFile = createJavaPidFile(pid); if(pidFile == null) { return false; } // wait for vm.paused file to be created and delete it once we find it. waitForAndResumeVM(pid); // unfortunately there's no reliable way to know the VM is ready to receive the // attach request so we have to do an arbitrary sleep. Thread.sleep(5000); HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(((Integer)pid).toString()); BufferedReader remoteDataReader = new BufferedReader(new InputStreamReader(vm.remoteDataDump())); String line = null; while((line = remoteDataReader.readLine()) != null); vm.detach(); return true; } finally { target.destroy(); target.waitFor(); if(pidFile != null && Files.exists(pidFile)) { Files.delete(pidFile); } } }
Example 6
Source File: AttachWithStalePidFile.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static boolean runTest() throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+PauseAtStartup", "AttachWithStalePidFileTarget"); Process target = pb.start(); Path pidFile = null; try { int pid = getUnixProcessId(target); // create the stale .java_pid file. use hard-coded /tmp path as in th VM pidFile = createJavaPidFile(pid); if(pidFile == null) { return false; } // wait for vm.paused file to be created and delete it once we find it. waitForAndResumeVM(pid); waitForTargetReady(target); HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(((Integer)pid).toString()); BufferedReader remoteDataReader = new BufferedReader(new InputStreamReader(vm.remoteDataDump())); String line = null; while((line = remoteDataReader.readLine()) != null); vm.detach(); return true; } finally { target.destroy(); target.waitFor(); if(pidFile != null && Files.exists(pidFile)) { Files.delete(pidFile); } } }
Example 7
Source File: AttachWithStalePidFile.java From hottub with GNU General Public License v2.0 | 5 votes |
public static boolean runTest() throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+PauseAtStartup", "AttachWithStalePidFileTarget"); Process target = pb.start(); Path pidFile = null; try { int pid = getUnixProcessId(target); // create the stale .java_pid file. use hard-coded /tmp path as in th VM pidFile = createJavaPidFile(pid); if(pidFile == null) { return false; } // wait for vm.paused file to be created and delete it once we find it. waitForAndResumeVM(pid); // unfortunately there's no reliable way to know the VM is ready to receive the // attach request so we have to do an arbitrary sleep. Thread.sleep(5000); HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(((Integer)pid).toString()); BufferedReader remoteDataReader = new BufferedReader(new InputStreamReader(vm.remoteDataDump())); String line = null; while((line = remoteDataReader.readLine()) != null); vm.detach(); return true; } finally { target.destroy(); target.waitFor(); if(pidFile != null && Files.exists(pidFile)) { Files.delete(pidFile); } } }
Example 8
Source File: AttachWithStalePidFile.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static boolean runTest() throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+PauseAtStartup", "AttachWithStalePidFileTarget"); Process target = pb.start(); Path pidFile = null; try { int pid = getUnixProcessId(target); // create the stale .java_pid file. use hard-coded /tmp path as in th VM pidFile = createJavaPidFile(pid); if(pidFile == null) { return false; } // wait for vm.paused file to be created and delete it once we find it. waitForAndResumeVM(pid); // unfortunately there's no reliable way to know the VM is ready to receive the // attach request so we have to do an arbitrary sleep. Thread.sleep(5000); HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(((Integer)pid).toString()); BufferedReader remoteDataReader = new BufferedReader(new InputStreamReader(vm.remoteDataDump())); String line = null; while((line = remoteDataReader.readLine()) != null); vm.detach(); return true; } finally { target.destroy(); target.waitFor(); if(pidFile != null && Files.exists(pidFile)) { Files.delete(pidFile); } } }
Example 9
Source File: AttachWithStalePidFile.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static boolean runTest() throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+PauseAtStartup", "AttachWithStalePidFileTarget"); Process target = pb.start(); Path pidFile = null; try { int pid = getUnixProcessId(target); // create the stale .java_pid file. use hard-coded /tmp path as in th VM pidFile = createJavaPidFile(pid); if(pidFile == null) { return false; } // wait for vm.paused file to be created and delete it once we find it. waitForAndResumeVM(pid); // unfortunately there's no reliable way to know the VM is ready to receive the // attach request so we have to do an arbitrary sleep. Thread.sleep(5000); HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(((Integer)pid).toString()); BufferedReader remoteDataReader = new BufferedReader(new InputStreamReader(vm.remoteDataDump())); String line = null; while((line = remoteDataReader.readLine()) != null); vm.detach(); return true; } finally { target.destroy(); target.waitFor(); if(pidFile != null && Files.exists(pidFile)) { Files.delete(pidFile); } } }
Example 10
Source File: JStackPidExecutor.java From bistoury with GNU General Public License v3.0 | 4 votes |
private String readJStackOutput(HotSpotVirtualMachine hotSpotVirtualMachine) throws IOException { try (InputStream inputStream = hotSpotVirtualMachine.remoteDataDump(new String[0])) { byte[] bytes = ByteStreams.toByteArray(inputStream); return new String(bytes, Charsets.UTF_8); } }