I love Wikipedia, I really do. I use it for everything. Well, not everything. For example, if I want a really good piece of chocolate cake, I tend to use flour, sugar, butter, eggs, chocolate, and not Wikipedia at all . For many things, however, Wikipedia cannot be surpassed. Imagine, then, my surprise when I found out that their page on Double-Checked Locking gave an example of a version of double-checked locking that does not work . // Broken -- Do Not Use! class Foo { private Helper helper = null; private boolean initialized = false; public Helper getHelper() { if (!initialized) { synchronized(this) { if (!initialized) { helper = new Helper(); initialized = true; } } } return helper; } (For background on Double-Checked Locking, see Bill Pugh's "Double-Checked Locking is Broken" Declaration .) The problem with this code is exactly the same as the problem with all of the other varia
Jeremy Manson's blog, which goes into great detail either about concurrency in Java, or anything else that the author happens to feel is interesting or relevant to the target audience.