[Mondrian] Double-checked locking

Julian Hyde jhyde at pentaho.com
Sat Nov 22 21:28:42 EST 2008


Most of you probably know that double-checked locking is unsound in Java.
But it bears repeating from time to time, because every Java programmer
writing threadsafe code needs to know it. Please read and digest.
 
http://en.wikipedia.org/wiki/Double-checked_locking
 
According to this article you can use the 'volatile' keyword from JDK 1.5
onwards and eliminate the problem. However, I would stick with the
'synchronize everything' approach unless you have a good reason to do
otherwise.
 
Julian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20081122/8d4c6c0f/attachment.html 


More information about the Mondrian mailing list