Virtual threads are a great tool which was added to the JDK in Java 21. But to get the most out of them we should use them properly with two features which are currently in their third preview phase. In this talk we will shine lights on these two awesome features StructuredTaskScope and ScopedValue. To be able to get a deep understanding of how we can use them to their full potential, we will start with an empty Java application. In a live coding session, we will iteratively update it together to a fully functioning, concurrent web application by combining Virtual threads with StructuredTaskScope and ScopedValue. During the process we will see why we should use ScopedValues instead of ThreadLocals when possible and how to build our own StructuredTaskScopes tailored to our needs. The goal of this talk is to provide to everyone who attends a deep understanding of how these new features work and how they can be used in a real life scenario.
Get notified about new features and conference additions.