Structured Concurrency

StructuredTaskScope as a lifetime guarantee for a fan-out: fork, join, close, and the rule that no subtask thread outlives the block. Covers the API as it stands on each JDK — still a preview API on every released version, renamed between 25 and 26 and changing again in 27 — the Joiner completion policies, scope timeouts, nesting, and what close actually waits for. Use when writing or reviewing a parallel fan-out inside one request, when a sibling task keeps running after another failed, when code copied from a blog uses ShutdownOnFailure or a StructuredTaskScope constructor, when preview class files fail to run on a different JDK, when a scope fails in milliseconds and closes in seconds, or when Subtask.get is called before join. Not why cancellation fails to arrive (cancellation-and-interruption), context inherited by subtasks (scoped-values), the threads underneath (thread-sizing-and-virtual-threads), or callback graphs (completablefuture-composition).

robsonkades 2bb945b 4 files · 30.6 KB Updated

File contents

robsonkades/agent-skills/tree/main/skills/structured-concurrency commit 2bb945b25a

Frequently asked questions

npx skillmds@latest add robsonkades/structured-concurrency