Witscale Test Center

12.4 Thread interaction with wait(), notify() and notifyAll()


12.4 Thread interaction with wait(), notify() and notifyAll()

Java threading supports interaction among threads. In means, the threads can tell each another about the important events. Threads especially need this interaction when they are working on shared objects. We saw earlier how you can protect the shared objects with a synchronized access and object locks. The threads can further refine the synchronized access by communicating with each other. The java.lang.Object class has three methods that make the thread interaction possible. The methods are wait(), notify(), and notifyAll().