Any VM supporting Process.supportsNormalTermination == true?

The new feature of Java 9 is that it can not only forcefully kill the processes (in meaning SIGKILL) that it created, but it can also support sending SIGTERM(in Java it is called "normal termination").

According to the Process documentation, you can ask if the implementation supports:

public boolean supportsNormalTermination () Returns true if the destroy () implementation is to terminate the process normally; Returns false if the kill execution is forced and terminates the process immediately. Calling this method in the process objects returned by ProcessBuilder.start () and Runtime.exec (java.lang.String) returns true or false depending on the platform.

I conducted several tests using Oracle JRE 9.0.1 (Windows 64bit):

Process p = Runtime.getRuntime().exec("javaw -cp target/classes TestClassWait10Minutes");
p.waitFor(5, TimeUnit.SECONDS);
System.out.println(p.supportsNormalTermination());

However, it seems that the Oracle JRE does not support "normal completion", as I always get false.

Since this depends on the "platform implementation", it seems that Java 9 defines it, but does not implement it.

Does anyone know if the "normal completion" function can be used at all in any available Java VM?

+4
1

Linux, , . ProcessImpl:

// Linux platforms support a normal (non-forcible) kill signal.
static final boolean SUPPORTS_NORMAL_TERMINATION = true;

...

@Override

public boolean supportsNormalTermination() {
    return ProcessImpl.SUPPORTS_NORMAL_TERMINATION;
}

Windows.

+4

Source: https://habr.com/ru/post/1689201/


All Articles