RFR: 8290036: Define and specify Runtime shutdown sequence [v4]
Stuart Marks
smarks at openjdk.org
Thu Aug 11 04:03:03 UTC 2022
On Mon, 8 Aug 2022 02:27:15 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 99:
>
>> 97: * <a href="{@docRoot}/../specs/jni/invocation.html#destroyjavavm">DestroyJavaVM</a>.
>> 98: * This function is responsible for initiating the shutdown sequence when the number of running
>> 99: * ({@linkplain Thread#isAlive() live}) non-daemon threads first drops to zero. When the shutdown
>
> I think we need to align this more with the proposed text of JLS 12.8. It needs to be clearer that `DestroyJavaVM` must be used in conjunction with `CreateJavaVM` to get the desired termination behaviour. Otherwise, the proposed text allows for the possibility that the JVM will always terminate when the last non-daemon thread terminates, even if `DestroyJavaVM` has not been called. It needs to be clear that if the JVM is started by the JNI Invocation API, then it must also be terminated by the JNI invocationAPI to get the required behaviour.
@dholmes-ora OK I've updated the implementation note to try to make it quite clear that the shutdown-at-zero-non-daemon-threads behavior is tied to `DestroyJavaVM`. (This is good; I didn't know this before I embarked on this exercise of updating these specs!) I'm not entirely sure of the state of JLS 12.8, but if I know Alex :-) it's unlikely to change much, and I think this section is consistent with it.
-------------
PR: https://git.openjdk.org/jdk/pull/9437
More information about the core-libs-dev
mailing list