Master Java's most significant concurrency upgrade with hands-on problems that build skill and confidence
Key FeaturesSolve 150+ problems that deepen your understanding of Project LoomExplore structured concurrency, scoped values, and virtual threads in depthBuild modern, high-performance Java applications using practical design patternsBook DescriptionTackling concurrency in Java has historically been complex, inefficient, and difficult to reason about—until now. This book guides you through Java’s modern concurrency revolution introduced by Project Loom. Through over 150 real-world problems, you'll build deep expertise in virtual threads, structured concurrency, and scoped values, equipping you to write performant, maintainable, and scalable concurrent applications.
Using a problem-solution approach, this book encourages active learning as you develop, test, and refine your solutions while gaining insight into the trade-offs behind different concurrency decisions. You’ll move from foundational concepts and API mechanics to internal workings, advanced design patterns, and complete case studies, making this the ideal reference to keep on your desk. Written by Anghel Leonard, a Java expert and prolific technical author, this book distills years of research and real-world experience into a comprehensive and approachable guide for modern Java concurrency.
By the end of this book, you’ll master modern Java concurrency by solving real-world problems and applying proven multithreading design patterns effectively.
What you will learnUnderstand the goals and inner workings of Project LoomWork confidently with virtual threads and structured concurrencyApply scoped values to manage thread-local state safelyCombine virtual threads with existing Java APIs and ExecutorsMonitor and trace concurrency behavior for observabilityRefactor legacy concurrent code using modern techniquesSolve concurrency design challenges with practical patternsImplement robust real-world solutions for high-throughput systemsWho this book is forJava developers who want to master Project Loom and write modern concurrent applications. This book also supports those preparing for Java job interviews or upgrading legacy systems. Prior experience with Java multithreading is recommended.
Table of ContentsHooking platform threads pitfallsIntroducing Virtual ThreadsCombining Virtual Threads and ExecutorsExamining how Virtual Threads work internallyTackling unstructured concurrencyHooking Structured Task Scope ThreadLocal vs ScopedValuesStructured Concurrency and Executors Observability Futures and PromisesExecutors, Semaphores, Locks, Barriers, AtomicsProducer/Consumer, Thread Pools, Fork/Join, ObjectsCompletable Futures, Reactive Streams