RFR: 8288984: Simplification in Shutdown.exit [v2]
Ryan Ernst
duke at openjdk.org
Sat Jul 2 21:21:38 UTC 2022
On Sat, 2 Jul 2022 19:32:04 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> 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.
>
> The first paragraph of the method description already makes it clear that the method never returns normally. One option for the third paragraph is to just remove it, another is to replace it with wording that specifies that the first thread to call exit is the winner and the exit code provided by other threads that attempt to exit around the same time (or while exit hooks execute) will be ignored. I think there is merit with adding a warning that a shutdown hook invoking exit will deadlock.
Thanks for the feedback, they are all good points. I opted to make the behavior with multiple threads more clear, see [8e7d527](https://github.com/openjdk/jdk/pull/9351/commits/8e7d527a182933818bd2d7f0f1b799dac52663be).
-------------
PR: https://git.openjdk.org/jdk/pull/9351
More information about the core-libs-dev
mailing list