JEP 505 revamps the structured concurrency API in JDK 25, previewing it for the fifth time with significant changes. The core type `StructuredTaskScope` is now a sealed interface instead of a non-final class, removing the ability to subclass it. Configuration is now handled via a `Configuration` object (supporting name, thread factory, and timeout) and a new `Joiner` abstraction that controls how subtask completion is handled. Built-in joiners cover common patterns: all-must-succeed with typed results, any-one-success short-circuit, and await-all regardless of outcome. The `join` method now throws subtask exceptions directly, eliminating the old `throwIfFailed` method. Cancellation propagates via thread interrupts, scoped values are inherited automatically by subtasks, and `jcmd` thread dumps now display the full task hierarchy tree.

10m read timeFrom nipafx.dev
Post cover image
Table of contents
▚ Structured Concurrency▚ Structured Concurrency in JDK 25

Sort: