RFR: 8290036: adjustments to specification of Runtime::addShutdownHook

David Holmes dholmes at openjdk.org
Wed Aug 3 00:54:51 UTC 2022


On Fri, 8 Jul 2022 23:00:15 GMT, Stuart Marks <smarks at openjdk.org> wrote:

> Initial edits to addShutdownHook from Alex.
> 
> See [JDK-8290036](https://bugs.openjdk.org/browse/JDK-8290036).

Hi Stuart,

There's nothing I would consider harmful in these changes, but I also don't see them as necessary.

Cheers.

src/java.base/share/classes/java/lang/Runtime.java line 145:

> 143:      * can create and start new threads during the shutdown sequence; the new
> 144:      * threads execute concurrently with their creators and may create and
> 145:      * start further threads.

True - but does it really need to be singled out for mention? I think explicitly pointing this out will just lead to follow up queries as to how such threads interact with the shutdown sequence.

src/java.base/share/classes/java/lang/Runtime.java line 175:

> 173:      * or loops infinitely) will prevent the shutdown sequence from completing.
> 174:      * In this case, the virtual machine can still be halted if a daemon or
> 175:      * non-daemon thread which is still running calls {@link #halt halt}.

Lines 174-175 basically repeat what was already said at lines 147-149

-------------

PR: https://git.openjdk.org/jdk/pull/9437


More information about the core-libs-dev mailing list