RFR: 8290036: Define and specify Runtime shutdown sequence [v4]

Stuart Marks smarks at openjdk.org
Mon Aug 8 22:59:37 UTC 2022


On Mon, 8 Aug 2022 02:06:18 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 55:
> 
>> 53:  * to one of several events:
>> 54:  * <ol>
>> 55:  * <li>when the number of {@linkplain Thread#isAlive() live} non-daemon threads drops to zero
> 
> Can we somehow forward-reference the implNote about DestroyJavaVM here?

added

> 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.

OK, yes I accept the general premise of your comment. Indeed we need to make sure this section is well aligned with JLS 12.8 (as well as the JNI spec and the JVMS, though I think those can be a bit more distant). I see that Alex has updated JLS 12.8 more recently than your comment, so I'll hold off editing this section for now and check with him to make sure he's done editing before I proceed. We might need some additional discussion as well. So, more to come.

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

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


More information about the core-libs-dev mailing list