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.
posted 8 years ago
Thanks for the reply. I decided to go for a less elegant polling solution in the end. Cheers, James.