...
Failure to encase the wait() or await() methods inside a while loop can lead to indefinite blocking and denial of service (DoS).
Rule | Severity | Likelihood |
|---|
Detectable | Repairable | Priority | Level |
|---|---|---|---|
THI03-J | Low | Unlikely |
Yes | No | P2 | L3 |
Automated Detection
| Tool | Version | Checker | Description |
|---|
| Klocwork |
|
|
|
| JAVA. |
FB.MT_CORRECTNESS.WA_NOT_IN_LOOP
| WAIT.IN.LOOP | |||||||||
| Parasoft Jtest |
| CERT.THI03.UWIL | Call 'wait()' and 'await()' only inside a loop that tests the liveness condition | ||||||
| SonarQube |
| S2274 | "Object.wait(...)" and "Condition.await(...)" should be called inside a "while" loop |
Wait not in loop
Bibliography
[API 2014] | |
Item 50, "Never Invoke | |
Section 14.2, "Using Condition Queues" | |
[Lea 2000] | Section 1.3.2, "Liveness" |
...
...