Reports double-checked locking. Double-checked locking is an (incorrect) way to initialize a field on demand in a thread-safe manner, while avoiding the cost of synchronization. Unfortunately it does not work and is not thread-safe. Read the linked article above for an explanation of the problem.

Example of incorrect double checked locking:


  class Foo {
    private Helper helper = null;
    public Helper getHelper() {
      if (helper == null)
        synchronized(this) {
          if (helper == null) helper = new Helper();
        }
        return helper;
      }
    }
    // other functions and members...
  }

Use the checkbox below to ignore double-checked locking on volatile fields. Using a volatile field for double-checked locking works correctly on JDK 1.5 and newer.