RFR: 8367857: Implement JEP 525: Structured Concurrency (Sixth Preview) [v4]
Alan Bateman
alanb at openjdk.org
Thu Oct 23 16:24:43 UTC 2025
On Thu, 23 Oct 2025 14:02:28 GMT, Viktor Klang <vklang at openjdk.org> wrote:
>> Alan Bateman has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 15 additional commits since the last revision:
>>
>> - Sync up from loom repo
>> - Merge branch 'master' into JDK-8367857
>> - Merge branch 'master' into JDK-8367857
>> - Sync up from loom repo
>> - Merge branch 'master' into JDK-8367857
>> - Sync up from loom repo
>> - Merge branch 'master' into JDK-8367857
>> - Merge branch 'master' into JDK-8367857
>> - Improve docs and review feedback
>> - Merge branch 'master' into JDK-8367857
>> - ... and 5 more: https://git.openjdk.org/jdk/compare/28ad1e1f...28617cff
>
> src/java.base/share/classes/java/util/concurrent/Joiners.java line 99:
>
>> 97: throw ex;
>> 98: } else {
>> 99: return subtasks.stream().map(Subtask::get).toList();
>
> Since the `subtasks` won't get collected until after the scope gets collected, we should probably clear the original collection before returning the resulting List.
The default (awaitAllSuccessFulOrThrow) doesn't keep anything alive. However, allSuccessFulOrThrow and allUntil do to allow for Joiner.result be called again. It's a bit an off piste usage to invoke directly but isn't prohibited:
"In normal usage, this method will be called at most once by the join method to produce the result (or exception). The behavior of this method when invoked directly, and invoked more than once, is undefined. Where possible, an implementation should return an equal result (or throw the same exception) on second or subsequent calls to produce the outcome."
We haven't changed anything in this update but we could drop the sentence about setting expectations about produce the same result.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27392#discussion_r2455882373
More information about the core-libs-dev
mailing list