
"Structured concurrency, exposed through java.util.concurrent.StructuredTaskScope, together with the abstraction, treats groups of related subtasks as a single unit of work. It addresses three concerns that ad-hoc thread management leaves unsolved: confining subtask lifetimes to the parent scope, reliably propagating cancellation, and surfacing thread hierarchies in observability tools."
"Preview 7 keeps that direction and focuses on exception ergonomics and type safety. JEP 533 frames the iteration as a focused refinement: the StructuredTaskScope and interfaces gain a third type parameter "for the type of the exception that the method of StructuredTaskScope can throw," and a new static method "implements the default join policy and uses a given UnaryOperator to produce the StructuredTaskScope configuration.""
"The headline change is the new exception type thrown by for the three standard joiners. In recent previews, Joiner.allSuccessfulOrThrow(), anySuccessfulOrThrow(), and awaitAllSuccessfulOrThrow() raised the preview-specific when a subtask failed. In Preview 7, those joiners now throw , the same wrapper that has long signalled subtask failure in ."
JEP 533, Structured Concurrency, is elevated to integrated status for JDK 27, continuing refinement since incubation in JDK 19 and previews starting in JDK 21. StructuredTaskScope treats related subtasks as a single unit of work, addressing lifetime confinement to a parent scope, reliable cancellation propagation, and improved observability of thread hierarchies. The iteration focuses on exception ergonomics and type safety. StructuredTaskScope and its interfaces gain a third type parameter for the exception type that StructuredTaskScope methods can throw. A new static method implements the default join policy and uses a UnaryOperator to produce configuration. Joiners now throw a new exception type, preserving the cause on the wrapper so existing catch-then-switch patterns remain applicable.
Read at InfoQ
Unable to calculate read time
Collection
[
|
...
]