RFR: 8367857: Implement JEP 525: Structured Concurrency (Sixth Preview)
Alan Bateman
alanb at openjdk.org
Wed Sep 24 08:53:35 UTC 2025
On Tue, 23 Sep 2025 08:42:02 GMT, Viktor Klang <vklang at openjdk.org> wrote:
>> Updates for JEP 525.
>>
>> - The join method is changed to invoke `Joiner::onTimeout` if a timeout is configured and the timeout expires before or while waiting.
>> - `Joiner.allUntil(Predicate`) is changed to allow join return the stream of all forked subtasks when the timeout expires.
>> - The `join` method is now specified to allow it be called again if interrupted.
>> - The configFunction parameter to the 3-arg open is changed from `Function<Configuration, Configuration>` to `UnaryOperator<Configuration>`.
>> - Joiner is no longer a `@FunctionalInterface`.
>>
>> Most of the changes are to API docs and tests. Some links are changed to use double hash mark.
>
> src/java.base/share/classes/java/util/concurrent/StructuredTaskScope.java line 208:
>
>> 206: * with the <a id="DefaultConfiguration"> <em>default configuration</em></a>. The default
>> 207: * configuration has a {@code ThreadFactory} that creates unnamed {@linkplain
>> 208: * Thread##virtual-threads virtual threads}, is unnamed for monitoring and management
>
> Is the second "unnamed" referring to the ThreadGroup itself? If so, it might be clearer to say "configuration has an unnamed ThreadFactory that creates unnamed virtual threads"
It's the scope name, I'll try to make this clearer.
> src/java.base/share/classes/java/util/concurrent/StructuredTaskScope.java line 242:
>
>> 240: * interrupts the threads executing the two subtasks) and the {@code Joiner}'s {@link
>> 241: * Joiner#onTimeout() onTimeout} method is invoked to throw {@link TimeoutException
>> 242: * TimeoutException}.
>
> Might be worth mentioning that said TimeoutException will then propagate upon the invocation of STS::join()?
It's probably too early in the docs to reference this method so I think clearer to clear this to the Joiner description.
> src/java.base/share/classes/java/util/concurrent/StructuredTaskScope.java line 1069:
>
>> 1067: * invoked to optionally throw {@link TimeoutException TimeoutException}. If the
>> 1068: * {@code onTimeout} method throws another exception or error then it is propagated
>> 1069: * by this method. Once finished waiting, and {@code onTimeout} does not throw, the
>
> Might be worth clarifying "Once finished waiting," to clarify what it is waiting for.
Reading this again then I think the issue is that there is too much in this paragraph, I'll split it into two.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27392#discussion_r2372751904
PR Review Comment: https://git.openjdk.org/jdk/pull/27392#discussion_r2372754564
PR Review Comment: https://git.openjdk.org/jdk/pull/27392#discussion_r2372755997
More information about the core-libs-dev
mailing list