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.
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.
Java thread states, each one demonstrated: what puts a thread in BLOCKED vs WAITING, why RUNNABLE can mean idle in a socket read, and how to read it in jstack.
A fair ReentrantLock still lets tryLock() cut the line, and a forgotten unlock() outlives its thread. ReentrantLock explained with a lab, dumps and numbers.
Found one Java-level deadlock in a thread dump? How to read it, what ThreadMXBean misses (virtual threads, pool starvation), and the fixes that hold.