File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
java/ql/src/Likely Bugs/Concurrency Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -68,9 +68,9 @@ variable can be used to avoid reading the field more times than neccessary.
6868
6969<p >
7070As a final note, it is possible to use double-checked locking correctly without
71- <code >volatile</code > if the constructed object is immutable in the sense that
72- all its fields are declared <code >final</code > and the double-checked field is
73- read exactly once outside the synchronized block.
71+ <code >volatile</code > if the object you construct is immutable. That is, the
72+ object declares all fields as <code >final</code >, and the double-checked field
73+ is read exactly once outside the synchronized block.
7474</p >
7575<p >
7676Given that all fields in <code >MyImmutableObject</code > are declared
@@ -101,9 +101,11 @@ Java Language Specification:
101101Wikipedia: <a href =" https://en.wikipedia.org/wiki/Double-checked_locking" >Double-checked locking</a >.
102102</li >
103103<li >
104+ Aleksey Shipilëv:
104105<a href =" https://shipilev.net/blog/2014/safe-public-construction/" >Safe Publication and Safe Initialization in Java</a >.
105106</li >
106107<li >
108+ Aleksey Shipilëv:
107109<a href =" https://shipilev.net/blog/2016/close-encounters-of-jmm-kind/" >Close Encounters of The Java Memory Model Kind</a >.
108110</li >
109111
You can’t perform that action at this time.
0 commit comments