Closed GoogleCodeExporter closed 9 years ago
FYI if you refer to lazy initialization in a multithreaded environment then the
Double-Checked Locking pattern is broken due to the java memory model
specification.
Original comment by amer...@gmail.com
on 27 Jan 2011 at 8:44
There's a right and a wrong way to do DCL. Feel free to review the change if
you want.
http://code.google.com/p/guava-libraries/source/diff?spec=svn160&r=160&format=si
de&path=/trunk/src/com/google/common/base/Suppliers.java&old_path=/trunk/src/com
/google/common/base/Suppliers.java&old=136
Original comment by kevinb@google.com
on 27 Jan 2011 at 8:56
You're right. Josh Bloch in its effective java 2nd edition clearly demonstrates
it by using a volative field, as you do ;-) and of course using compilation
version >= 1.5 to prevent running on java 1.4, as you do too.
Original comment by amer...@gmail.com
on 27 Jan 2011 at 10:08
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:15
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:09
Original issue reported on code.google.com by
kevinb@google.com
on 27 Jan 2011 at 7:34