Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Notifying a single thread rather than all waiting threads can violate the liveness property of the system.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

THI02-J

Low

Unlikely

Medium

P2

L3

Automated Detection

ToolVersionCheckerDescription
CodeSonar
Include Page
CodeSonar_V
CodeSonar_V
PMD.Design.UseNotifyAllInsteadOfNotify
FB.MT_CORRECTNESS.NO_NOTIFY_NOT_NOTIFYALL
Use notifyAll instead of notify
Using notify() rather than notifyAll()
Parasoft Jtest
Include Page
java:
Parasoft_V
java:
Parasoft_V
TRS.ANFImplemented
SonarQube Java Plugin
Include Page
SonarQube Java Plugin_V
SonarQube Java Plugin_V
S2446
 
- "notifyAll" should be usedImplemented

Related Guidelines

Bibliography

[API 2006]

Interface java.util.concurrent.locks.Condition

[Bloch 2001]

Item 50, "Never Invoke wait Outside a Loop"

[Goetz 2006]

Section 14.2.4, "Notification"

[JLS 2015]

Chapter 17, "Threads and Locks"

...


...