An exception thrown inside an async stage doesn't crash a thread the way it would in synchronous code — it gets captured inside the CompletableFuture. This article covers exceptionally, handle, and whenComplete, the three ways to observe and recover from that failure.
Not every pipeline is a straight line. This article covers thenCompose for chaining dependent async steps and thenCombine for merging two independent futures, and explains why picking the wrong one produces a future nested inside a future.
CompletableFuture keeps the same idea as Future — a result that isn't ready yet — but adds the ability to attach transformations and callbacks directly, so a pipeline can be built without ever blocking a thread just to wait.
Every task handed to an ExecutorService so far has been fire-and-forget. This article introduces Callable and Future, showing how to get a result back from asynchronous work and why blocking on get() still isn't enough.
Not every coordination problem is about protecting shared state. Sometimes threads just need to wait for each other at the right moments, or share a limited resource fairly, and java.util.concurrent has a purpose-built tool for each shape.
BlockingQueue lets producer threads and consumer threads hand off work through a queue that blocks instead of failing when it is empty or full, replacing hand-rolled wait and notify with a tested, well-behaved data structure.
Plain HashMap and ArrayList are not just slower under concurrent mutation, they are unsafe. The java.util.concurrent collections were built from the ground up to be shared across threads without external locking.
Every new Thread() has a real memory and context-switching cost, as the first phase of this series covered. ExecutorService bounds and reuses threads instead, and gives task submission a proper return value through Future.
AtomicInteger and its relatives fix the same lost-update problem as synchronized, without ever blocking a thread, by building on a single hardware instruction: compare-and-swap.
volatile fixes the visibility hang from the previous phase in one word, but it is one of the most misunderstood keywords in Java because it does not make compound operations atomic.