Wait and Notify in Java: The Rules That Stop the Hangs
wait() and notify() hang or corrupt data when the guard, the lock or the wakeup is wrong. Lost signals, stolen wakeups and notify vs notifyAll, run on JDK 21.
wait() and notify() hang or corrupt data when the guard, the lock or the wakeup is wrong. Lost signals, stolen wakeups and notify vs notifyAll, run on JDK 21.
On JDK 21, with the virtual-thread scheduler pinned to one carrier thread, four virtual threads that each do Thread.
Why one thread can't see another thread's write. The Java Memory Model, reordering, and every happens-before rule explained with code you can actually test.
A Java condition variable gives one lock several wait sets. How await() and signal() work, why one Condition hangs a buffer, and a bounded buffer done right.
A race condition in Java can survive a ConcurrentHashMap and synchronized on every call. Check-then-act, critical sections, and how to prove the bug is there.
A fair ReentrantLock still lets tryLock() cut the line, and a forgotten unlock() outlives its thread. ReentrantLock explained with a lab, dumps and numbers.
Learn how to use Java's synchronized keyword correctly — with real payment and banking examples covering race conditions, synchronized methods, blocks, deadlock-free transfers, double-checked locking, and virtual thread pitfalls. Covers Java 8 through 21