...
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 | 4.2 | FB.MT_CORRECTNESS.DC_DOUBLECHECK | Possible double check of field | ||||
Coverity | 7.5 | DOUBLE_CHECK_LOCK | Implemented | ||||
Parasoft Jtest | 9.5 | TRS.DCL | Implemented | ||||
SonarQube Java Plugin |
|
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] |
...
...