RFR: 8290036: Define and specify Runtime shutdown sequence [v7]
David Holmes
dholmes at openjdk.org
Sun Aug 28 22:24:22 UTC 2022
On Sat, 27 Aug 2022 08:18:10 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Stuart Marks has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Minor adjustments
>
> src/java.base/share/classes/java/lang/Thread.java line 70:
>
>> 68: * The newly started thread invokes the task's {@link Runnable#run() run} method.
>> 69: *
>> 70: * <p> A platform thread <i>terminates</i> if either its {@code run} method completes
>
> I don't think the update in 9796557d works. It switches to talking about the termination of platform threads before we've introduced what a platform thread is. It also switches to talking about the Thread.run method when the focus in the previous paragraph has been the the task that the thread executes. If we really need this here then the second paragraph will need to explain that it is also possible to extend Thread and override the run method.
I don't think we need to distinguish between platform and virtual threads here at all. Isn't it the case that virtual threads also have a run() method and they too terminate when run() completes as described (together with UEH)? The fact most Thread run() methods call something else's run() method is immaterial. We don't know what a run() method will do, but whatever it is once it completes then the thread has terminated.
-------------
PR: https://git.openjdk.org/jdk/pull/9437
More information about the core-libs-dev
mailing list