Directed notifyAll()

A question if I may. Lets suppose that my main thread creates 3 threads. These 3 threads call wait() on a certain object. Then the main thread calls notifyAll() for the same object. How can I ensure …