review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid) (original) (raw)

Rob McKenna rob.mckenna at oracle.com
Wed Apr 11 23:48:23 UTC 2012


Hi folks,

I'm hoping for some feedback on the above. Webrev:

http://cr.openjdk.java.net/~robm/4244896/webrev.00/

This bug adds two abstract methods to Process.java with the intention of:

  1. providing a facility to implement a destroyForcibly method. In practical terms this means provide a method that will send a SIGKILL to the subprocess in *nix environments as opposed to the SIGTERM that is currently being sent. (Windows' destroy() method effectively behaves like this already)

  2. providing a facility to check whether the subprocess is still alive.

As per the bug report the toString/pid work has been left to be completed separately.

Notes:

a) It has been pointed out to me that the addition of abstract methods to java.lang.Process should be discussed, particularly as to whether default methods should be provided.

b) In src/windows/native/java/lang/ProcessImpl_md.c I chose to use WaitForSingleObject on the off chance that a process may choose to return STILL_ACTIVE as an error code.

Thanks!

 -Rob


More information about the core-libs-dev mailing list