Skip to Content
Modern Concurrency in Java
book

Modern Concurrency in Java

by A N M Bazlur Rahman
September 2025
Intermediate to advanced
336 pages
8h 23m
English
O'Reilly Media, Inc.
Book available
Content preview from Modern Concurrency in Java

Chapter 7. Modern Frameworks Utilizing Virtual Threads

The best way to predict the future is to invent it.

Alan Kay

With the introduction of virtual threads in JDK 21, the Java ecosystem has witnessed a significant shift in how frameworks handle concurrency. Many modern frameworks have embraced virtual threads to improve performance, scalability, and resource efficiency.

In this chapter, we will explore how leading frameworks, such as Spring Boot, Quarkus, and Jakarta EE, are integrating virtual threads. However, we will not go into the inner workings of these frameworks, as I assume those interested would prefer to explore each one in depth on their own.

Let’s begin.

Spring Boot

Spring Boot is one of the de facto frameworks for building enterprise applications in the Java ecosystem.

Historically, Spring Boot web applications have primarily followed a thread-per-request model, where a dedicated platform thread handles each incoming client request. While this approach works well under moderate loads, it encounters scalability challenges when dealing with a high volume of concurrent I/O-bound requests, as these requests are always served through platform threads.

To mitigate this, Spring Boot introduced asynchronous programming capabilities with annotations like @Async and abstractions such as TaskExecutor. However, this approach still relied on limited pools of platform threads, as shown in the following example:

@Configuration
public class ThreadPoolConfig {
    @Bean
    public ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Concurrency in Practice

Java Concurrency in Practice

Brian Goetz, Tim Peierls, Joshua Bloch, Joseph Bowbeer, David Holmes, Doug Lea
Modern Java in Action

Modern Java in Action

Raoul-Gabriel Urma, Mario Fusco, Alan Mycroft

Publisher Resources

ISBN: 9781098165406Errata PageSupplemental Content