Virtual threads have landed in Java 21, but Christian Woerz shows how to unlock their full power using two third-preview-phase features: StructuredTaskScope and ScopedValue. In a live-coding session he starts from scratch, then builds a fully concurrent web app that pairs virtual threads with custom StructuredTaskScopes and swaps out ThreadLocals for ScopedValues.
By the end you’ll see why ScopedValues beat ThreadLocals for passing request data, how to craft your own StructuredTaskScopes for real-world needs, and get a deep, hands-on grasp of Java’s freshest concurrency tools.
Watch on YouTube
Top comments (0)