Structured Concurrency in Java: The What & Why
summary
Project Loom features virtual threads that scale to thousands or millions and let code focus on business tasks instead of thread pools; demos use Thread.ofVirtual, Executors.newThreadPerTask and JUnit wrappers. Live-coded comparisons show CompletableFuture’s callback chains versus an imperative Structured Task Scope that joins subtasks, e.g. create-event (reserve venue, book hotel, buy supplies), first-completing weather source, and customer-offer (customer then savings+loans then calculate offer). Structured Concurrency provides shutdown-on-failure / shutdown-on-success policies, checked execution exceptions, automatic cancellation of siblings, and warns about pinning when synchronized blocks block carrier threads.
AI-written summary · about
chapters (12)
- 0:00Intro
- 0:27Project Loom
- 1:55How to create virtual threads?
- 3:53Demo
- 6:55Virtual Threads continued
- 8:28Demo
- 9:07Virtual Threads continued
- 10:53Structured Concurrency
- 14:42CompletableFuture API vs Structured Concurrency API
- 15:09Demo
- 38:55Shutdown policies
- 40:43Outro
related talks
43mStructured Concurrency in Java - The What and the Why
57mStructured Concurrency in Java
34mIntroduction and pitfalls of Java's new concurrency model
48mMake Your Code Parallel with the Structured Concurrency API
49mJava's Concurrency Journey Continues! Structured Concurrency & Scoped Values
02h 43mVirtual Threads, Structured Concurrency and Scoped Values in Java 25 and Beyond
02h 17mJava's Concurrency Journey Continues! Exploring Structured Concurrency and Scoped Values
47mConcurrent and Asynchronous Programming: Loom in Java 20 and 21
