RFR: 8284199: Implementation of Structured Concurrency (Incubator)
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Mon May 23 21:11:52 UTC 2022
On Thu, 19 May 2022 13:05:54 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.
Marked as reviewed by mcimadamore (Reviewer).
src/jdk.incubator.concurrent/share/classes/jdk/incubator/concurrent/StructuredTaskScope.java line 88:
> 86: * {@code join} method after forking.
> 87: *
> 88: * <p> StructuredTaskScope defines the {@link #shutdown() shutdown} method to shut down a
This sentence, because of the place where it appears, is a bit confusing. So far we only know about the fact that a scope has an owner thread. So it seems odd that shutdown could be called _while_ the owner thread is waiting on a `join`. Of course, then you read what's next, and you discover that: (a) shutdown might be called by a custom scope subclass and that (b) shutdown is confined to the threads contained in this task scope - but this definition is only given much later.
src/jdk.incubator.concurrent/share/classes/jdk/incubator/concurrent/StructuredTaskScope.java line 353:
> 351: *
> 352: * <p> The {@code handleComplete} method should be thread safe. It may be
> 353: * invoked by several threads at around the same.
Something is missing? E.g. "at around the same TIME" ? (I'd suggest just using "concurrently")
src/jdk.incubator.concurrent/share/classes/jdk/incubator/concurrent/StructuredTaskScope.java line 376:
> 374: *
> 375: * <p> If this task scope is {@linkplain #shutdown() shutdown} (or in the process
> 376: * of shutting down) then {@code fork} returns a Future representing a {@link
Future in plaintext?
-------------
PR: https://git.openjdk.java.net/jdk/pull/8787
More information about the core-libs-dev
mailing list