How to close a Process and having shutdown hooks called ?
Alan.Bateman at oracle.com
Tue Mar 4 12:12:11 UTC 2014
On 04/03/2014 11:51, Krystal Mok wrote:
> Hi Nicolas,
> Looks like a well discussed question. On Posix systems, SIGTERM should work
> for you. That's the default signal sent by the 'kill' command on Linux.
> e.g. please take a look here:
> - Kris
I think he's on Windows and is looking for destroy to use something
other than TerminateProcess.
As background, the destroy method was confusingly specified to kill the
sub-process forcibly but it wasn't implemented this way everywhere. On
Unix/Linux then the long standing implementation used SIGTERM and so no
guarantee that it would cause the sub-process to terminate. This
mismatch was examined in JDK 8 (you'll need to go through the archives
of this mailing list to see the discussion) and the javadoc updated to
make it clear that it is implementation specific as to whether it is
done forcibly or not. In addition a new destroyForcibly was added to do
the SIGKILL or TerminateProcess for cases where you really want to kill
the child. There isn't a corresponding destroyGracefully but clearly
this would be useful if were feasible to implement everywhere.
More information about the core-libs-dev