< prev index next >
test/lib/testlibrary/jdk/testlibrary/ProcessTools.java
Print this page
*** 25,36 ****
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
- import java.lang.management.ManagementFactory;
- import java.lang.management.RuntimeMXBean;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
--- 25,34 ----
*** 251,265 ****
/**
* Get the process id of the current running Java process
*
* @return Process id
*/
! public static int getProcessId() throws Exception {
! RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
! int pid = Integer.parseInt(runtime.getName().split("@")[0]);
!
! return pid;
}
/**
* Get platform specific VM arguments (e.g. -d64 on 64bit Solaris)
*
--- 249,260 ----
/**
* Get the process id of the current running Java process
*
* @return Process id
*/
! public static int getProcessId() {
! return (int) ProcessHandle.current().getPid();
}
/**
* Get platform specific VM arguments (e.g. -d64 on 64bit Solaris)
*
< prev index next >