Add a basic API for "Structured Concurrency". Structured concurrency treats multiple tasks running in different threads as a single unit of work, thereby streamlining error handling and cancellation, improving reliability, and enhancing observability. The API is proposed as a preview API. It previously incubated as JEP 428 and JEP 437.
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.
The preview APIs proposed are:
java.util.concurrent.StructuredTaskScope java.util.concurrent.StructuredTaskScope.Subtask java.util.concurrent.StructuredTaskScope.Subtask.State java.util.concurrent.StructuredTaskScope.ShutdownOnSuccess java.util.concurrent.StructuredTaskScope.ShutdownOnFailure java.util.concurrent.StructureViolationException
In conjunction with JEP 446, remove module jdk.incubator.concurrent.
A zip file with the spec diff is attached. This issue is also linked to online API docs to make it easier to look at.