Posted By:
Edward_Harned
Posted On:
Thursday, August 2, 2001 01:51 PM
In order for threads to talk to each other, they must both lock on the same Monitor.
Your wait() and notify() cannot work because you have not locked the monitor for the thread object.
The full explanation is far too lengthy to repeat here. There are numerous examples of wait/notify in every book on Java. You may also see Allen Holub's articles on threading at
http://www.javaworld.com/ and his latest
Warning! Threading in a multiprocessor world, by Allen Holub
http://www.javaworld.com/jw-02-2001/jw-0209-toolbox.html