RFR: 8288984: Simplification in Shutdown.exit [v2]

David Holmes dholmes at openjdk.org
Sun Jul 3 22:25:26 UTC 2022


On Sat, 2 Jul 2022 21:21:37 GMT, Ryan Ernst <duke at openjdk.org> wrote:

>> This is a followup to simplify Shutdown.exit after the removal of
>> finalizers (https://bugs.openjdk.org/browse/JDK-8198250). Once agreement
>> on the approach has been reached in this PR, a CSR will be filed to
>> propose the spec change to Runtime.exit.
>
> Ryan Ernst has updated the pull request incrementally with one additional commit since the last revision:
> 
>   better clarify multiple threads behavior

Changes requested by dholmes (Reviewer).

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

> 87:      * of the first invocation will be used; the status codes from other invocations
> 88:      * will be ignored. If this method is invoked from a shutdown hook the system
> 89:      * will deadlock.

Expressing this accurately is tricky - what is "first" here? I suggest the following:

> Invocations of this method are serialized such that only one invocation will actually proceed with the shutdown sequence and terminate the VM with the given status code. All other invocations will block indefinitely. If this method is invoked from a shutdown hook the system will deadlock.

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

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


More information about the core-libs-dev mailing list