...
This compliant solution uses notifyAll
which sends notifications to all threads that wait on the same object. Thus, liveness is not affected unlike the non-compliant example. Ensure that the lock is released quickly promptly after the call to notifyAll
.
...