If there is no thread which is waiting, using Object.wait() , any calls to Object.notify() or Object.notifyAll() have no effect. I hav
Object.wait()
Object.notify()
Object.notifyAll()
Use a flag to indicating a notification. Read the flag before entering wait and act accordingly.
boolean stopped = false; public void run(){ synchronized(object){ while(!stopped) object.wait(); } } public void stop(){ synchronized(object){ stopped=true; object.notify(); } }