On Thu, 4 Aug 2022 02:51:03 GMT, Stuart Marks <sma...@openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/Runtime.java line 79:
>> 
>>> 77:  * terminate the JVM via the {@link #halt halt} method.
>>> 78:  * <h2><a id="termination">Virtual Machine Termination</a></h2>
>>> 79:  * When the JVM terminates, all threads (daemon, non-daemon, and 
>>> shutdown hooks) are immediately
>> 
>> "daemon, non-daemon, and shutdown hooks" reads like there are 3 kinds of 
>> threads. I would be tempted to drop "shutdown hooks" from this list or else 
>> phrase it as "all shutdown hooks and all other threads".
>
> Alex and I discussed this and we felt that it was important to call out all 
> three "kinds" of threads explicitly. Earlier versions of the text implied 
> that no non-daemon threads were running at the time the VM terminated, which 
> might not be true. Earlier text also implied that shutdown hooks had 
> terminated before the VM terminated, but this isn't necessarily true if 
> somebody calls halt(). Yes, a shutdown hook has a daemon/non-daemon bit, but 
> effectively it's ignored, and a shutdown hook is treated so specially that 
> it's effectively a different kind of thread.

I understand but as currently worded the reader may wonder what 
Thread::isDaemon might return when it invoked on Thread that is a shutdown 
hook. I think the best I can suggest is to replace "daemon, non-daemon, and 
shutdown hooks" with "shutdown hooks and other daemon and non-daemon threads".

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

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

Reply via email to