The notify() Method
Home ] Up ] The wait() Method ] [ The notify() Method ] Other wait() Methods ] The notifyAll() Method ]

 

 

public final void notify()

Wakes up a single thread that is waiting on this object's monitor. A thread waits on an object's monitor by calling one of the wait methods. This method should only be called by a thread that is the owner of this object's monitor. A thread becomes the owner of the object's monitor in one of three ways:

  • By executing a synchronized instance method of that object.
  • By executing the body of a synchronized statement that synchronizes on the object.
  • For objects of type Class, by executing a synchronized static method of that class.

Only one thread at a time can own an object's monitor.

The notify() method:

  • Throws IllegalMonitorStateException if the current thread is not the owner of this object's monitor.
 
The page was last updated February 19, 2008