Concurrent Programming in Java with Virtual Threads
Reactive programming improves the throughput of microservices. This course explains how virtual threads and structured concurrency improve the reactive programming model, by writing simpler code that is easier to maintain and debug.
What you'll learn
Designing a reactive system is complex and leads to code that is hard to test, hard to debug, and expensive to maintain. Virtual threads have been added to the Java platform to overcome these problems, and make it so that your simple imperative and blocking code is the right solution to design reactive systems. In this course, Concurrent Programming in Java with Virtual Threads, you will learn how virtual threads and structured concurrency can improve the reactive programming model. First, you will explore the patterns you can use to run your application on virtual threads. Then, you will learn how virtual threads are working under the hood, so that you can make informed decisions on where to use them in your application. Finally, you will see several applications use cases, built on virtual threads through the use of structured concurrency, to put everything in practice. When you are finished with this course, you will be fully equipped to improve your applications with virtual threads and structured concurrency, something you will need to improve the maintainability of your reactive and asynchronous code.
Table of contents
- Introducing the Course and Its Agenda 3m
- Who Are You and What Do You Need to Know to Follow This Course 3m
- Defining the Throughput of an Application 2m
- Defining Synchronous and Asynchronous Execution 3m
- Defining What Concurrent Execution Means 3m
- Defining Blocking Code and Why You Need to Avoid It 3m
- Analyzing the Performance of a Web Request 4m
- Using Concurrent Programming to Increase Your Throughput 4m
- Module Wrap Up 1m
- Introducing Virtual Threads and the Module Agenda 2m
- Handling Web Requests with Reactive Programming 4m
- Analyzing the Costs of the Reactive Programming Model 3m
- Building a New Model of Thread 1m
- Demo: Exploring the Patterns to Create Your First Virtual Threads 6m
- Demo: Launching 1 Million Virtual Threads 2m
- Module Wrap Up 1m
- Introducing the Module and its Agenda 1m
- Introducing Carrier Threads to Run Virtual Threads 2m
- How Virtual Threads Are Executed by Carrier Threads 5m
- Demo: What Is Happenning When Your Code Blocks a Virtual Thread? 4m
- Demo: Analyzing How Continuations Are Working 3m
- Preventing the Blocking of Carrier Threads with Continuations 4m
- Pinning a Virtual Thread on Its Carrier Thread with a Native Call 3m
- Fixing the Pinnning on Synchronization Issue with ReentrantLock 3m
- Choosing When to Refactor to ReentrantLock 2m
- Comparing Reactive Programming and Virtual Threads 5m
- Module Wrap Up 2m
- Introducing the Module and its Agenda 4m
- Getting Rid of Loose Threads with Structured Concurrency 5m
- Demo: Creating a First StructuredTaskScope for Weather Forecast 7m
- Demo: Using ShutdownOnSuccess for the Weather Forecast Query 3m
- Demo: Using StructuredTaskScope to Book Simple Flights 6m
- Demo: Creating a FlightScope by Extending StructuredTaskScope 12m
- Demo: Implementing Multileg Flights with ShutdownOnFailure 7m
- Demo: Querying Simple and Multileg Flights to Get the Best Price 6m
- Demo: Adding the Weather Forecast to the Travel Booking 4m
- Module Wrap Up 2m