Structured Concurrency: Why JEP 505 Changes How We Think About Cancellation, Not Just Syntax
Java Code Geeks, Tuesday, October 13th, 2026
JEP 505 makes parent-child task relationships visible so Java can cancel orphaned subtasks automatically.
With ExecutorService and Futures, the relationship between a request and its forked subtasks exists only in the programmer's head.
As a result, when one call fails, the other keeps holding connections and threads for a request that no longer exists.
The article argues that JEP 505 structured concurrency is mainly about making that task tree visible to the platform, so that failure, interruption or early return cancels the children.
Virtual threads make the issue sharper, because cheap threads encourage more forking and therefore more leaks.