RFR: 8284199: Implementation of Structured Concurrency (Incubator) [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Tue May 24 10:57:07 UTC 2022


On Tue, 24 May 2022 10:41:59 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> This is the implementation of JEP 428: Structured Concurrency (Incubator).
>> 
>> This is a non-final API that provides a gentle on-ramp to structure a task as a family of concurrent subtasks, and to coordinate the subtasks as a unit.
>
> 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 six additional commits since the last revision:
> 
>  - Use {@code ...}, replace task->subtask, fix typos, add jls ref
>  - Merge
>  - @ignore StructuredThreadDumpTest until test infra in place
>  - Refresh
>  - Merge
>  - Initial commit

src/jdk.incubator.concurrent/share/classes/jdk/incubator/concurrent/StructuredTaskScope.java line 214:

> 212:  * <h2><a id="TreeStructure">Tree structure</a></h2>
> 213:  *
> 214:  * StructuredTaskScopes form a tree where parent-child relations are established

Should we mention what happens in the owner thread completes its execution and the scope's `close` method has not been called? I think that, as discussed offline, the fact that the thread will attempt to close any nested scopes when terminating is an important aspect of this API.

src/jdk.incubator.concurrent/share/classes/jdk/incubator/concurrent/StructuredTaskScope.java line 1110:

> 1108:          * invoked {@link #join() join} (or {@link #joinUntil(Instant) joinUntil}).
> 1109:          * The behavior of this method is unspecified when invoking this method before
> 1110:          * the {@code join} is invoked.

Suggestion:

         * {@link #join} is invoked.

test/jdk/jdk/incubator/concurrent/StructuredTaskScope/StructuredThreadDumpTest.java line 200:

> 198:     }
> 199: 
> 200: }

Watch out for the newline here

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

PR: https://git.openjdk.java.net/jdk/pull/8787


More information about the core-libs-dev mailing list