Java - when to use notify or notifyAll?

Posted by mdma on Stack Overflow See other posts from Stack Overflow or by mdma
Published on 2010-05-14T13:09:32Z Indexed on 2010/05/14 13:14 UTC
Read the original article Hit count: 293

Why does java.lang.Object have two notify methods - notify and notifyAll? It seems that notifyAll does at least everything notify does, so why not just use notifyAll all the time? If notifyAll is used instead of notify, is the program still correct, and vice versa? What influences the choice between these two methods?

© Stack Overflow or respective owner

Related posts about java

Related posts about multithreading