Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Parasoft Jtest 2021.1

...

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
Parasoft Jtest
Include Page
CodeSonar
Parasoft_V
CodeSonar
Parasoft_V
PMD
CERT.
Design
THI02.
UseNotifyAllInsteadOfNotify
FB.MT_CORRECTNESS.NO_NOTIFY_NOT_NOTIFYALL
ANFDo not use 'notify()'; use 'notifyAll()' instead so that all waiting threads will be notified
SonarQube
Include Page
SonarQube_V
SonarQube
Use notifyAll instead of notify
Using notify() rather than notifyAll()Parasoft Jtest9.5TRS.ANFImplementedSonarQube Java Plugin Include PageSonarQube Java Plugin_VSonarQube Java Plugin
_V
S2446
Implemented
"notifyAll" should be used

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"

...


...

Image Modified Image Modified Image Modified