
Explore the introduction to Java 21 virtual threads and structured concurrency, learn how lightweight threads boost scalability while preserving sequential style, and preview reactive programming concepts and Project Loom.
Use diagrams to explain virtual threads, platform threads, processes, with yellow notes and blue arrows, and note concurrent users, scalability, and loom early access builds in Java 19, not production.
Explore how Java threads affect scalability across rest APIs, microservices, and web apps, and examine nonblocking frameworks like Project Reactor and Spring Flux, plus Project Loom and virtual threads.
Discover how web applications handle ironbound and CPU bound tasks across databases, microservices, and external systems, and how resource limits influence scalability and concurrency.
Examine architectures for handling user requests, including CGI, fast CGI, and thread-per-request models, and explain how blocking IO with thread pools drives Java servers like Tomcat and WebLogic.
Explore the distinction between concurrency and parallelism, and compare synchronous and asynchronous calls, showing how thread pools, IO-bound workloads, and futures shape scalable Java applications.
Explore how Java platform threads map to OS threads, how the JVM manages heap and stack memory, and how a simple command line program demonstrates thread frames and memory usage.
Demonstrates the practical limit of concurrent threads on a Mac, showing an out-of-memory native thread failure around two thousand when using a 1 mb stack and 1 gb heap.
Examine how thread pools cap scalability in application servers and how CPU–IO dynamics shape concurrency for many concurrent users, highlighting why releasing threads quickly matters.
Explore non-blocking IO and its impact on scalability, contrasting blocking and non-blocking workflows, including callbacks and thread pooling, and introduce Java 21 virtual threads and structured concurrency.
Install the early access build of Project Loom and JDK 19 to demonstrate virtual threads and why they improve scalability for rest APIs, and explore creation approaches.
Download the early access Loom JDK based on JDK 19, extract it on Mac, and configure Eclipse and the command line to use the Loom 19 JDK for virtual threads.
Explore how Java virtual threads scale concurrency by running thousands of daemon threads in loom jdk, showing race conditions, thread IDs, and the need to join for completion.
Explore how Java virtual threads enable millions of concurrent requests by offloading IO waits from platform threads, preserving the same programming model with dramatic concurrency gains.
Explore methods to create virtual threads in Java, including the thread class static method, a virtual builder with a factory, and a per-task executor service, using futures for concurrency.
Explore the current limitations of virtual threads, including synchronized monitors blocking on IO, JNI interactions, and memory concerns; learn workarounds with java.util.concurrent locks and structured concurrency.
Explore simulating concurrent user requests with Java 21 virtual threads and structured concurrency. Examine non-blocking io, blocking calls, and continuations, plus practical http bin.org rest calls and monitoring via jconsole.
Create a Java project with loom and run multiple users via a virtual thread executor. Simulate a database call and a rest call as network requests, returning a combined result.
Experiment with rest scalability using java 21 virtual threads, running sequential and parallel calls to simulate users, observe platform thread limits, and apply a fixed thread pool for safer scalability.
Use Jconsole to monitor heap memory and threads. Run 500 platform threads, then 500 virtual threads to see virtual threads use far fewer platform threads.
Leverage Java 21 virtual threads and futures to run db call and rest call concurrently, using futures and invoke all to improve performance while preserving readable, sequential-style code.
Use virtual threads and completable futures to run a db call and a rest call in parallel, then compose results in a non-blocking pipeline with thenCombine and thenApply.
Explains how virtual threads boost enterprise scalability by replacing platform threads to support more users per instance, enabling structured concurrency and cost savings in cloud environments.
Explore how structured concurrency brings order to asynchronous programming by ensuring threads started within a block terminate on exit, using virtual threads and Java platform tools.
Demonstrates structured concurrency using an executor service within a try-with-resources block, ensuring child threads terminate on exit while highlighting cancellation and failure handling complexities.
Explore structured concurrency with a parent thread, structured scope, and join point, detailing four use cases - wait for all, fail-fast, first to respond, or a custom scenario.
Learn how to cancel child threads using interrupts in Java, including the interrupt flag, isInterrupted vs interrupted, and future cancel in executors.
Create a long running task in Java that can complete, fail, or be canceled to demonstrate structured concurrency with Java 21 and JDK Loom.
Explore structured concurrency in Java by using structured task scope and subtask to run child tasks with virtual threads, fork them, and join for results while handling cancellation and exceptions.
Explore StructuredTaskScope with Java 21 virtual threads to run subtasks, observe join behavior, and ensure clean cancellation and shutdown on success, failure, or interrupt.
Explore how structured task scope enforces shutdown on failure, canceling remaining subtasks when one fails, using fork, join, and throw patterns on data and rest tasks.
Explore structured concurrency with shutdown on success in structured task scope, returning the first successful weather data while canceling remaining tasks, using join and result to handle outcomes.
Create a custom structured task scope that wakes join after two successful subtasks, gathers results, and computes the average weather and time with a synchronized list.
Visualize a parent thread creating a structured task scope and forking child scopes A, B, C, and D, with cancellation propagating via joins to guarantee termination.
Discover scoped values, a preview feature in JDK 21, and learn how they address thread locals and memory issues with virtual threads and structured concurrency, especially structured task scope.
Explore how thread-local variables create per-thread scope in Java, using set and get to store thread-specific values in a per-thread map, with initializers and thread-safe access.
Explore inheritable thread locals, which copy parent values to child threads, revealing user data and highlighting copy semantics, thread safety, and customization via the child value and initial value methods.
analyze the drawbacks of thread locals, including unbounded mutability, memory leaks from missing removals, and inheritance in virtual threads, and preview scoped value as the proposed solution.
Explore scoped value, a slimmed down per-thread variable that binds values in a dynamic scope to share data from parent to child with immutability.
This lecture demonstrates scoped values as dynamic, thread-scoped bindings by binding a user to a scope, showing how methods access the bound value without parameters, and exploring multiple binding patterns.
Rebind the scoped value within a dynamic scope to a new binding, so inner methods see the updated value, then revert when the scope ends; contrast runnable and callable behavior.
Compare coroutines with subroutines, showing how yields suspend and resume across entry points. Learn how continuations capture the stack and code pointer to support Java virtual threads.
Explore delimited continuations in Java by wrapping a method in a continuation, using scope and yield to simulate coroutines, illustrating stack preservation with loom virtual threads.
Explore how Java continuation scopes manage yield transitions between scope one and scope two, showing how a continuation can call another and yield back to the correct loop.
Wraps a runnable in an IO processor to implement a continuation within a Java 21 virtual thread, illustrating blocking and resuming when IO data arrives.
Explore how Java virtual threads are scheduled on a ForkJoinPool using continuations, enabling non-blocking i/o seamlessly and revealing the role of carrier and platform threads.
Learn how Spring Boot on Tomcat uses virtual threads and structured concurrency to scale with many users, configure Spring Boot for virtual threads, and build a simple rest endpoint.
Build a Spring Boot app with a /demo endpoint that prints the serving thread to show whether requests run on platform or virtual threads, using Spring Boot 3.2.
Explore using Spring Boot with virtual threads to handle more concurrent i/o requests. Enable this with spring.threads.virtual.enabled; observe how virtual threads replace platform threads.
Build a scalable Spring Boot REST API using Java 21 virtual threads and structured task scope to fetch deals from Wonder and Mascot bookstores and compute the best price.
Demonstrate building a scalable bookstore REST API with Java 21 virtual threads and structured concurrency, featuring two profile-based stores, a five-second response delay, and up to 50,000 concurrent connections.
Build a Spring Boot rest api that fetches prices from two bookstores in parallel using virtual threads and structured concurrency to return the best price.
Measure api timings with Java 21 virtual threads and structured concurrency to collect per-store timing data. Bind a scoped time map and dump timings to a CSV log.
Explore scalability testing for the best price book service: deploy bookstore APIs on Linux and Mac, benchmark with AB to 40,000 concurrent connections, tune file descriptors, and coordinate cross-machine tests.
Explore scalability testing for java 21 apps by deploying three services, benchmarking with Apache benchmark, and tuning virtual threads, memory, and horizontal/vertical scaling strategies.
This conclusion shows how Java 21 virtual threads and structured concurrency enable writing sequential code that scales, with scoped values and Spring Boot 3.2 for non-blocking, cost-efficient apps.
Explore ways to create Java platform threads, from extending Thread to using Runnable, off platform, and lambdas. Learn essential thread methods like current thread, interrupt, join, sleep, and daemon status.
Learn how futures decouple task submission from execution by using a thread pool via the executor service, exposing runnable and callable tasks and futures for results, cancellation, and structured concurrency.
Explore futures in Java by submitting runnable and callable tasks to executors, using futures and completion services to efficiently handle results as they complete, with future tasks and handling exceptions.
Analyze why Java futures struggle in reactive, asynchronous pipelines and need imperative blocks, due to blocking concerns and limited API. Contrast with CompletableFuture, the fluent alternative.
Explore CompletableFuture as the Java feature for reactive style programming, orchestrating parallel tasks with then combine, then apply, then accept, via completion stages.
Create a completable future pipeline by starting tasks with runAsync or supplyAsync, then chain with thenApply and thenAccept. Handle exceptions with exceptionally and understand pipeline creation versus execution.
Learn to compose and combine completable futures with then apply, then compose, and then combine, using supplyAsync to run tasks in parallel and build sequential pipelines.
Clarifies which threads trigger each stage in a CompletableFuture pipeline, showing when supplyAsync and thenApply run on the common pool or a custom executor, and why async variants matter.
Coordinate multiple asynchronous tasks with CompletableFuture allOf and anyOf under Java 21 virtual threads. Handle completion and exceptions with join, get, and exceptionally, even when results differ in type.
Learn how the CompletableFuture API enables multi-task asynchronous workflows across cpu-bound and io-bound tasks. See examples of complete and complete exceptionally, async http calls, and asynchronous file reads.
Explore remaining CompletableFuture tidbits, including whenComplete and handle, with timeouts, and compare reactive styles (Project Reactor, RxJava) to Java 21 virtual threads for scalable, imperative programming.
Recent Updates :
Updated all Java code to use JDK 25 and Spring Boot code to use Spring Boot 4.X or 3.5.X
Project demonstrating scaling a Spring Boot application to 100,000 concurrent users with impressive response time
Project Loom in a new revolutionary initiative in OpenJDK to create a Lightweight implementation of Threads called Virtual Threads. Java Virtual Threads revolutionize the way non blocking code is written and dramatically reduce costs by using less resources in the Cloud. Instead of relying on complex Reactive programming, Java developers can now write code sequentially and still achieve the same result in many cases. This is one of the most extensive changes in the Java Platform and it is a game changer for writing highly scalable Multithreading applications. Existing code (like Spring Boot code) can also take advantage of this new technology with minor modifications.
Developers and Architects can help their Organization cut costs by using less number of machines to support the same number of users. Be a hero by proposing the use of Virtual Threads in your project.
WHAT THE LEARNERS ARE SAYING:
5 STARS - This was pleasurable journey. Very informative, understandable and easy to follow. I wish there was such a course about java io/nio, net/sockets on Udemy.
5 STARS - Excellent course .. simplified such a complex topic ! Great work !!
5 STARS - Excellent introduction to virtual threads and the complex concepts are explained with simple diagrams, which makes it easy to visualize the inner workings of virtual threads.
5 STARS - Great course. Nice start with describing all the concurrency concepts. Course includes practical examples and descriptive diagrams to understand better the internal workings of virtual threads. If somebody is interested in this subject - this course is a good choice to understand how threads in java works and virtual threads.
5 STARS - Amazing course, great job! I would highly recommend this course to anyone who wants to dive deeper into the concurrency topic.
In this course, you will learn the following
How to increase scalability and dramatically reduce costs using Virtual Threads ?
What is the reason behind scalability issues of Java Platform Threads ?
What are Virtual Threads and how are they different from Platform Threads ?
How can developers scale their application using Virtual Threads in Spring Boot ?
How do Virtual Threads work and why it's a game changer ?
How do we use Virtual Threads with Java Futures and Completable Futures ?
What is Structured Concurrency and how to use it in Java ?
What are Scoped Values and how are they different from Thread Locals ?
What are Delimited Continuations ?
How do we do Multithreading with Virtual Threads and Structured Concurrency ?
How are Virtual Threads implemented using Continuations ?
What is the difference between Java Virtual Threads and Reactive programming (at a high level) ?
Bonus Section on Java Futures and Completable Futures as a Refresher
Join me in exploring Virtual Threads using a step-by-step and Hands-On approach to learning. By the end of the course, you will have an excellent grasp of Virtual Threads, Structured Concurrency, Thread Locals, Scoped Values and Continuations and how they can be used to write highly scalable Java applications using Spring Boot.
REMEMBER… I'm so confident that you'll love this course that we're offering a FULL money-back guarantee for 30 days! So it's a complete no-brainer, sign up today with ZERO risk and EVERYTHING to gain.
Note : Structured Concurrency classes are available in JDK as a Preview feature and is subject to change.