This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Don't you need two loops in two separate threads? At the moment, other than the first call to doSomethingAndRepeat in the main method, you've got the calls to wait and notify in the same thread. Which means the thread is waiting for itself.
This probably isn't what you wanted, but here's a similar example where two threads take it in turns.
Joined: Jan 22, 2004
Thanks for the reply. I decided to go for a less elegant polling solution in the end. Cheers, James.