StructuredTaskScope And ScopedValue - Get The Most Out of Virtual Threads
summary
Live-codes a small Spring Boot app that uses Java 21 virtual threads plus the preview features StructuredTaskScope and ScopedValue to turn three 500 ms blocking info calls (Google, LinkedIn, Facebook — Facebook throws) plus a 1 s talk call into a concurrent, robust flow. Builds a custom StructuredTaskScope with custom Joiner that picks the best result, swaps mutable ThreadLocal for ScopedValue replaces ThreadLocal, and shows with JMeter (≈1,000 concurrent requests) that end-to-end latency drops to 1 second end-to-end while handling failures and exceptions gracefully.
AI-written summary · about
chapters (8)
- 0:00Virtual threads intro
- 1:07Virtual threads performance
- 7:53Virtual threads limits
- 12:13StructuredTaskScope
- 16:46Custom joiner
- 23:51StructuredTaskScope features
- 24:53ScopedValues vs ThreadLocal
- 32:36Recap & Q&A
related talks
49mStructuredTaskScope And ScopedValue - Get The Most Out of Virtual Threads
44mStructuredTaskScope And ScopedValue - Get The Most Out of Virtual Threads
44mStructuredTaskScope And ScopedValue - Get The Most Out of Virtual Threads
42mVirtual Threads, Structured Concurrency and Scoped Values: Putting it all together
01h 03mBeyond Virtual Threads: Structured Concurrency
48mVirtual Threads, Structured Concurrency and Scoped Values: Putting it all together
47mVirtual Threads, Structured Concurrency & Scoped Values: Putting it All Together
44mGet The Most Out of Virtual Threads in Java 25: A Deep Dive
