Looks good.

I would probably have had the hook interrupt the main thread while it was running ie sleep(5000); main.interrupt(); sleep(5000); but pre-interrupting itself before calling exit is probably functionally equivalent.

David

On 24/06/2016 2:32 AM, Chris Hegarty wrote:
The shutdown hooks race against the shutdown sequence if the thread
invoking System.exit() is interrupted.  This happens because
ApplicationShutdownHooks::runHooks joins the shutdown hooks. This
may lead to premature VM shutdown, with shutdown hooks not fully
executed.

http://cr.openjdk.java.net/~chegar/8154017/
https://bugs.openjdk.java.net/browse/JDK-8154017

-Chris.

Reply via email to