
Examine how the operating system schedules processes and threads and how Java threads wrap OS threads to execute code, and how virtual threads address blocking in microservices.
Demonstrate platform thread creation limits with IO intensive tasks, show out of memory or resource limits when scaling, and motivate virtual threads for scalable concurrency.
Explore virtual threads in Java through demos that compare platform and virtual threads, show creation via a thread builder, and demonstrate daemon behavior and scaling up to millions of threads.
Demonstrate how virtual threads run under carrier threads, showing thread info, parking and unparking, and how a ForkJoinPool worker thread executes virtual tasks, sometimes switching workers.
Explore how platform threads and virtual threads handle a CPU intensive task by executing a recursive Fibonacci workload with no I/O, using a timer to compare execution times and behavior.
Trace thread pinning when using virtual threads by enabling JDK.trace.find-threads in development. Review full or short stack traces to identify synchronized IO in libraries.
Explore essential thread methods for virtual threads, including is virtual, join with countdown latch, and interrupt, and learn to parallelize tasks like product and pricing service calls.
Explore a single jar simulating two external microservices (product and rating) with virtual threads, making simple get requests to endpoints, and a configurable port accessible via swagger UI.
Develop a simple external service client in the playground project to fetch data from a local service at localhost:7070 using product and rating endpoints with id-based URLs.
Demonstrates accessing remote responses with future by submitting callables to a virtual-thread executor, awaiting results via future.get, and running parallel product info calls to speed up requests.
Explain how concurrency handles multiple tasks over time and how parallelism uses multiple subtasks to run simultaneously, using Java threads and Java.util.concurrent.
Implement an ordered concurrency limiter for virtual threads by queuing tasks and letting a concurrent linked queue deliver them in submission order, regardless of thread id.
Discover Java 24's stream gatherer and the map concurrent gatherer, enabling custom operators and parallel virtual threads to fetch and collect results.
Learn how to create a simple CompletableFuture, complete it with a value, and retrieve it with get or join, then accept the result on a consumer via a virtual thread.
Explore how to use CompletableFuture.runAsync with factory methods and executors, run a runnable asynchronously, switch to virtual thread per task executor, and handle completion with thenRun and exceptionally.
Learn how to supply asynchronous results with CompletableFuture.supplyAsync using a supplier, compare it to runAsync, and use a virtual executor to handle blocking I/O in Java virtual threads.
Pass CompletableFuture.supplyAsync with an executor to retrieve three product information in parallel from an external service, improving error handling while running on virtual threads.
Execute an aggregator demo using CompletableFuture supply async to run product and rating calls in parallel, and handle failures with exceptionally to provide fallbacks like minus one or product not found.
Learn to run parallel product detail calls with CompletableFuture.allOf, supplyAsync with an executor, gather futures, convert to an array, and join to collect results, with timeout considerations.
Explore how CompletableFuture enables non-blocking, asynchronous processing with error handling and result combination, using a ForkJoinPool or a per-task executor with virtual threads in Java 21.
Use thread local as a disciplined tool by hiding it behind a helper class and always pairing set with remove to manage security request-related metadata, observability, and tracing.
Explore scoped values in JDK 25, a safer alternative to threadlocal that works with platform and virtual threads. It binds a value to a key and unbinds after runnable completes.
Replace thread-local storage with scoped values, creating a scoped value key (session token) and using authenticate with runnable blocks on two virtual threads to produce tokens.
Explore scoped values and their rebinding of a session token within a nested scope, switching to an inner token in a runnable and automatically restoring the outer value.
Explore how scoped values store carriers linked by previous references and accessed via dot run and dot get, revealing how long lookups can affect performance and guiding session data design.
Explore structured concurrency as a preview feature in Java, using virtual threads to run subtasks and manage their lifecycle with a structured task scope and joiner strategies.
Learn the any successful result strategy by racing subtasks with scope.join to return the first successful response, cancel remaining tasks, and handle fail cases with potential custom join strategies.
Set up a Spring project from start.spring.io with Java, Maven, or Gradle, Spring Boot 3.2+ and Java 21, include web, import into IDE, and scaffold client, config, controller, dtos, service.
Define and implement all required dto models for a travel planning app, including accommodation, events, weather, transportation, trip plan, and flight reservations, using Java records and swagger-driven design.
Inject service clients and use an executor service to fetch events, weather, accommodations, transportation, and recommendations in parallel, then assemble a trip plan with safe defaults when a call fails.
Copy and paste the application properties accurately to avoid mistakes, and adjust the port 7070 if needed. Learn how the spring threads flag is initialized and later enabled.
Create an executor service config with two beans: a virtual thread per task executor and a platform thread executor, conditionally active based on Spring threads virtual enabled.
Build a JMeter test script to simulate concurrent users against a REST endpoint, using a thread group and HTTP request, and analyze response time and throughput.
Explore how throughput and response time relate in a demo, showing transactions per second, response time trends over time, and the value of multiple listeners with aggregate and time-based reports.
Explore VisualVM for monitoring Java 21 apps, compare with Jconsole, and observe CPU, GC, class loading, and virtual threads while analyzing memory and HTTP client threads to fix issues.
Configure the rest client to use an HttpClient with a virtual thread per task executor when spring.threads.virtual.enabled is true, replacing the platform-thread request factory and ensuring thread counts stay flat.
Use the command line interface for JMeter tests, disable listeners to save memory, ignore warmup results due to JVM delays, and run tests on separate machines.
Create a trip reservation test script in a new JMeter test plan with http post. Configure json body and headers, run test, and verify the response includes a reservation ID.
Analyze virtual thread performance using JMeter with a warmup, 300 users, 300 seconds ramp-up, and 360 seconds of testing, comparing platform-thread and virtual-thread throughput and latency results.
Compare platform threads and virtual threads by running the trip plan api under parallel loads, tuning the executor service, and monitoring thread usage with Visual VM.
Switch to virtual threads, run the warmup and ramped tests with a trip plan file, and compare results to reveal low cpu usage and only 36 threads.
Compare results between platform and virtual threads by loading trip plans and analyzing response time and throughput. Virtual threads achieve higher throughput up to 300 rps with stable response times.
Migrate existing apps to virtual threads for IO tasks, verify synchronized usage, and adopt a thread-per-task executor to avoid expensive platform threads.
Up-to-date with JDK/Java 26: This course covers all the latest Java features, including finalized Scoped Values, the latest preview of Structured Concurrency (JEP 505), and the foundational power of Virtual Threads.
Master modern, high-performance Java concurrency and build applications that scale effortlessly. This course takes you from foundational Multithreading concepts to the cutting edge of Virtual Threads, Structured Concurrency, and Scoped Values, all reinforced with hands-on Spring Boot projects.
Course Highlights:
Understanding Concurrency: Start with the basics. Understand platform threads, their lifecycle, and the challenges of traditional concurrency. Learn why scaling with conventional threads is difficult and how Java Virtual Threads provide a lightweight, high-performance alternative for handling thousands of concurrent tasks efficiently.
ExecutorService Mastery: Dive into ExecutorService and see how it works with both platform threads and virtual threads. Learn to manage concurrency, execute tasks in parallel, and optimize thread usage for scalable applications.
CompletableFuture Integration: Explore CompletableFuture for asynchronous task execution with Virtual Threads. Learn practical patterns for chaining tasks, handling exceptions, and managing timeouts in a clean, declarative way.
ThreadLocal and Scoped Values: Understand ThreadLocal for storing thread-specific context and the challenges it poses. Then explore Scoped Values, the modern alternative that works seamlessly with both platform and virtual threads, avoids memory leaks, and simplifies context propagation.
Structured Concurrency: Get a hands-on introduction to Java’s Structured Concurrency APIs, learning how to manage groups of tasks as a single unit, improve reliability, and simplify lifecycle management of concurrent tasks.
Hands-On Application Development: Apply your knowledge in a Spring Boot Web project using Virtual Threads. Learn how these concurrency concepts integrate into real-world application development.
Performance Testing with JMeter: Test the scalability of your application using JMeter, measuring throughput and response times to ensure optimal efficiency under various workloads.
Migration Made Easy: Conclude the course with a practical migration guide to transition your existing applications to Java Virtual Threads effortlessly. Get ready for a future where your programs effortlessly combine concurrency and scalability.
Don't just learn concurrency. Master the future of high-performance Java. Unlock the full potential of Virtual Threads, Structured Concurrency, and Scoped Values to design the most scalable, efficient, and modern applications on the platform.