...
Code Block | ||
---|---|---|
| ||
else if(number == 3) { Thread.sleep(2000); list.notifyAll(); } |
Exceptions
EX1: If there are several similar threads waiting for a notification, and it is permissible to invoke either of them, notify()
may be used. There should be a relaxed liveness criteria.
Risk Assessment
To guarantee the liveness of a system, the method notifyAll()
should be called rather than notify()
.
...