Structured Concurrency in Java - The What and the Why
summary
Live coding demonstrates that Java’s Structured Concurrency uses virtual threads to run one thread per business task (thousands to millions cheaply), with a StructuredTaskScope API (e.g. shutdownOnFailure, shutdownOnSuccess) to fork, join and propagate cancellation. Examples: event management (three subtasks joined), weather (first successful wins — unlike CompletableFuture.anyOf failure behavior), and customer -> parallel savings+loans then offer. Implementations run and match expected behavior; caveats include runtime errors when join is omitted and pinning on synchronized/native calls.
AI-written summary · about
chapters (8)
- 0:00Introduction
- 1:27Structured concurrency basics
- 4:35Project Loom and virtual threads
- 8:58Virtual threads in action
- 12:25Structured concurrency in Java
- 16:16API comparison and examples
- 38:04Advanced patterns and pinning
- 40:06Q&A session
related talks
41mStructured Concurrency in Java: The What & Why
57mStructured Concurrency in Java
49mJava's Concurrency Journey Continues! Structured Concurrency & Scoped Values
48mMake Your Code Parallel with the Structured Concurrency API
02h 17mJava's Concurrency Journey Continues! Exploring Structured Concurrency and Scoped Values
34mIntroduction and pitfalls of Java's new concurrency model
54mStructured Concurrency: Hierarchical Cancellation & Error Handling
51mIntroduction and Pitfalls of Java's New Concurrency Model
