...
Using incorrect forms of the double-checked locking idiom can lead to synchronization problems and can expose partially initialized objects.
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
LCK10-J | Low | Probable | Medium | P4 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
CodeSonar |
| JAVA.CONCURRENCY.LOCK.DCL | Double-Checked Locking (Java) | ||||||
Coverity | 7.5 | DOUBLE_CHECK_LOCK | Implemented | ||||||
Parasoft Jtest |
| CERT.LCK10.DCL | Avoid unsafe implementations of the "double-checked locking" pattern | |||||||
PVS-Studio |
| V5304, V6082 | |||||||
SonarQube |
| S2168 |
Related Guidelines
Bibliography
[API 2014] |
Item 48, "Synchronize Access to Shared Mutable Data" | |
Item 71, "Use Lazy Initialization Judiciously" | |
[JLS 2015] | |
[Manson 2004] | JSR 133 (Java Memory Model) FAQ |
[Manson 2006] |
[Manson 2008] | Data-Race-ful Lazy Initialization for Performance |
[Shipilёv 2014] |
...