The double checked locking - Broken
If you're thinking of using the following code to optimize thread contention in java, don't!
Read the following posts first:
class Foo
{
private Helper helper = null;
public Helper getHelper()
{
if (helper == null)
{
synchronized(this)
{
if (helper == null)
{
helper = new Helper();
}
}
}
return helper;
}
}