Why did we use notifyAll()
instead of notify()
in in line 36
synchronized (this) {
empsInBathroom--;
if (empsInBathroom == 0) inUseBy = NONE;
// Since we might have just updateded the value of
// inUseBy, we should notifyAll waiting threads
this.notifyAll();
}