Virtual Threads, Structured Concurrency, and Scoped Values: Explore Java’s New Threading Model
Ron Veen, David Vlijmincxlanguage. Project Loom adds virtual threads, structured concurrency, and scoped values which
help you as a developer to write better concurrent applications. Each of the chapters gives you an
introduction to the topic and shows you when you should consider it or totally avoid it.
Chapter 1: The first chapter covers what virtual threads are and how they are different from the
threads that we already had in previous Java versions. This will show the life cycle virtual threads
go through while executing code and how it works or doesn’t work in some situations.
Chapter 2: This chapter covers structured concurrency which is a totally new concept that has
been added to the Java language. You will learn new ways of managing the lifetime of your
threads and how to make relationships between threads more explicit.
Chapter 3: The third chapter covers a new and immutable way of sharing values between
threads. With previous versions of Java, you could use thread local variables, but with Java 21
there is a new way that is better fitted to use with virtual threads. You will learn how these scoped
values work and how they work with structured concurrency.
Chapter 4: In the final chapter, we go over how to reason about virtual threads, so you know
how to best apply them and how to use them with common patterns. You will also learn how to
start using virtual threads inside your Spring or Quarkus applications.