Interprocess, Interthreaded communication in Java: wait, notify, notifyAll methods

Message is a way of thread communication. By this process a Java thread can communicate with another. Java uses wait( ), notify( ), and notifyAll( ) methods in a synchronized environment for interthreaded and interprocess communication.

wait method: It is used to notify a thread to go to sleep.


final void wait( ) throws InterruptedException

notify method: It is used to wake up a thread.


final void notify( )

notifyAll method: It is used to wake all threads for execution. The thread which would be picked up for execution must be the highest priority thread.


final void notifyAll( )

Leave a Reply