Java Concurrency: Deep Dive

Eight posts on java.util.concurrent, each built from small Java programs actually compiled and run, showing a real behavioral contrast rather than an API tour: executors and thread pools, Future/CompletableFuture, CountDownLatch/CyclicBarrier, Semaphore, synchronized vs ReentrantLock, ReadWriteLock/StampedLock, atomics, and BlockingQueue.

  1. Executors & Thread Pools: What Actually Happens to Queued and Interrupted Tasks (Part 1 of 8)
  2. Future, Callable, CompletableFuture: Blocking, Timing Out, and Not Blocking At All (Part 2 of 8)
  3. Coordinating Threads: CountDownLatch & CyclicBarrier (Part 3 of 8)
  4. Limiting Concurrency: Semaphore (Part 4 of 8)
  5. Explicit Locks: synchronized vs ReentrantLock (Part 5 of 8)
  6. ReadWriteLock & StampedLock: Concurrent Reads, and When an Optimistic Read Fails (Part 6 of 8)
  7. Atomics: AtomicInteger vs a Plain Counter, and a CAS Loop Actually Retrying (Part 7 of 8)
  8. BlockingQueue: Producer/Consumer with ArrayBlockingQueue and SynchronousQueue (Part 8 of 8)