RFR: 8290036: Define and specify Runtime shutdown sequence [v4]
Stuart Marks
smarks at openjdk.org
Mon Aug 8 22:49:20 UTC 2022
On Mon, 8 Aug 2022 01:55:08 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Stuart Marks has updated the pull request incrementally with one additional commit since the last revision:
>>
>> More edits from Alex's suggestions.
>
> src/java.base/share/classes/java/lang/Runtime.java line 66:
>
>> 64: * {@linkplain Thread#start started} in some unspecified order. They run concurrently
>> 65: * with any daemon or non-daemon threads that were {@linkplain Thread#isAlive() alive}
>> 66: * at the beginning of the shutdown sequence.
>
> or which subsequently get started as covered later. So perhaps a simple reordering here:
>
>> <p>At the beginning of the shutdown sequence, the registered shutdown hooks are {@linkplain Thread#start started} in some unspecified order.
>
>> <p>After the shutdown sequence has begun, registration and de-registration of shutdown hooks with {@link #addShutdownHook addShutdownHook} and {@link #removeShutdownHook removeShutdownHook} is prohibited. However, creating and starting new threads is permitted.
>
>> <p> The shutdown hooks run concurrently with any daemon or non-daemon threads that were {@linkplain Thread#isAlive() alive} at the beginning of the shutdown sequence; or which are subsequently started.
Alex and I have gone over this about three times. Your suggestion is shorter, but it requires a closer read to see all the cases. In particular, it answers the questions "what happens to currently running threads" and specifically mentions both daemon and non-daemon threads. Various earlier bits of text implied incorrectly that non-daemon threads could no longer be running during the shutdown sequence or even at the end of the shutdown sequence. Being explicit makes things somewhat redundant but it covers the cases more thoroughly.
> src/java.base/share/classes/java/lang/Runtime.java line 85:
>
>> 83: * effect on the shutdown sequence is unspecified.
>> 84: *
>> 85: * <h2><a id="termination">Virtual Machine Termination</a></h2>
>
> Should this say "Java Virtual Machine Termination" for consistency.
will fix
-------------
PR: https://git.openjdk.org/jdk/pull/9437
More information about the core-libs-dev
mailing list