RFR: 8290036: Define and specify Runtime shutdown sequence [v4]
David Holmes
dholmes at openjdk.org
Mon Aug 8 02:42:09 UTC 2022
On Sat, 6 Aug 2022 08:11:53 GMT, Alan Bateman <alanb 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/Thread.java line 73:
>
>> 71: * or if its {@code run} method completes abruptly and the appropriate
>> 72: * {@linkplain Thread.UncaughtExceptionHandler uncaught exception handler} completes
>> 73: * normally or abruptly. With no code left to run, the thread has completed execution.
>
> I'm in two minds about introducing the UHE in paragraph 3 but probably okay as you kinda have to mention it when defining termination. There's a lot more to this story when you have agents in the picture but I'll not go there. I wonder if we can do something with the last sentence that includes the word "terminated". We use "terminated" in several places and it would be clearer if this sentence were to end with something like "... the thread has completes execution, and is terminated" (it could link to isAlive or Thread.State#TERMINATED).
>
> Given that the join method is introduced as the method to wait for a thread to terminate then it could be part of this paragraph rather than a single sentence paragraph.
I would also suggest that the join() sentence simply be the last sentence of the above paragraph:
> The join method can be be used to wait for a thread to terminate.
> src/java.base/share/classes/java/lang/Thread.java line 104:
>
>> 102: * The <a href="Runtime.html#shutdown">shutdown sequence</a> begins when all started
>> 103: * non-daemon threads have terminated. Unstarted non-daemon threads do not prevent
>> 104: * the shutdown sequence from commencing. Invoking the {@linkplain Runtime#exit(int)}
>
> I think this is the only usage of "commencing", everywhere else uses "beginning" or "begin the shutdown sequence".
"initiated" is also used.
-------------
PR: https://git.openjdk.org/jdk/pull/9437
More information about the core-libs-dev
mailing list