Summary
Structured Concurrency was proposed by JEP 428 and delivered in JDK 19 as an incubating API. JEP 437 proposes to re-incubate the API without changes, in JDK 20, to allow time for more feedback and to get more experience with this feature.
The only change in the re-incubated API is that StructuredTaskScope
is updated to support the inheritance of scoped values by threads created in a task scope. This streamlines the sharing of immutable data across threads. The API change (docs only) will be included in the CSR for JEP 429.
Problem
The goal of this feature is unchanged, that is the goal is to improve the maintainability, reliability, and observability of multithreaded code, in a style that eliminates common risks arising from cancellation and shutdown.
Solution
The APIs that are proposed to continue to incubate in module jdk.incubator.concurrent
and package jdk.incubator.concurrent
are:
class StructuredTaskScope
class StructuredTaskScope.ShutdownOnSuccess
class StructuredTaskScope.ShutdownOnFailure
exception StructureViolationException
Specification
There are no specification changes proposed.
A future CSR will likely do some refinements, e.g. have the API docs set expectations when subclassing, or maybe change the return type from the fork
method. We propose to wait for more feedback before making changes to the API.
- csr of
-
JDK-8296779 Implementation of Structured Concurrency (Second Incubator)
-
- Resolved
-
- relates to
-
JDK-8284200 Implementation of Structured Concurrency (Incubator)
-
- Closed
-
-
JDK-8306916 Implementation of Structured Concurrency (Preview)
-
- Closed
-