MENU

Fun & Interesting

Thread Signaling in Java

Jakob Jenkov 14,204 2 years ago
Video Not Working? Fix It Now

Java has a set of thread signaling features that enable one Java thread to coordinate its actions with another. These basic thread signaling features are provided via the Object class wait() , notify() and notifyAll() methods. When implementing thread signaling in Java you need to be aware of the problem of missed signals and spurious wakeups. I cover both in this video too. Chapters: 0:00 Java Thread signaling introduction - wait(), notify() and notifyAll() 1:50 Calling wait(), notify() or notifyAll() must be done from within a synchronized block 2:31 Calling wait() releases the synchronization lock 5:50 Designing a thread signaling class in Java 9:17 Missed signals 17:24 notify() vs. notifyAll() 19:24 Spurious wakeups Java Thread Signaling - text: https://jenkov.com/tutorials/java-concurrency/thread-signaling.html Java Concurrency - text: https://jenkov.com/tutorials/java-concurrency/thread-signaling.html Java Concurrency - playlist: https://www.youtube.com/playlist?list=PLL8woMHwr36EDxjUoCzboZjedsnhLP1j4

Comment