O'Reilly logo

Java 9: Building Robust Modular Applications by Jason Lee, Peter Verhas, Dr. Edward Lavieri

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Terminating processes

To terminate a process we can call the destroy() method or the destroyForcibly() method on the ProcessHandle instance. Both of these methods will terminate the process. The destroy() method is expected to terminate the process gracefully executing the process shutdown sequence. In this case the shutdown hooks added to the run time are executed if the actual implementation supports the graceful, normal termination of processes. The destroyForcibly() method will enforce process termination, and in this case the shutdown sequence will not be executed.

If the process managed by the handle is not alive then nothing happens when the code calls any of these methods. If there are any CompletableFuture objects created calling ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required