RFR: 8288984: Simplification in Shutdown.exit

Ryan Ernst duke at openjdk.org
Sat Jul 2 14:12:39 UTC 2022


On Sat, 2 Jul 2022 13:21:06 GMT, David Holmes <dholmes 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.
>
> src/java.base/share/classes/java/lang/Runtime.java line 88:
> 
>> 86:      * <p> Invocations of this method block indefinitely. It is therefore
>> 87:      * inadvisable to invoke this method from a shutdown hook as it will
>> 88:      * cause deadlock.
> 
> This is inaccurate. The method only blocks indefinitely when shutdown has already commenced.

If a shutdown hook is running, then shutdown has started, right? This new wording isn’t really a change, it’s the current behavior (the “otherwise” portion of the old wording). But the wording is meant to be more accurate for the case of running exit from shutdown hooks. The change is the removal of the first case, which is what the code portion of the PR removes.

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

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


More information about the core-libs-dev mailing list