Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added link to a Singleton Factory patterns example and fixed Shipilёv 2014 reference

...

The double-checked locking idiom is frequently used to implement a Singleton Factory singleton factory pattern that performs lazy initialization.  Lazy initialization defers the construction of a member field or an object referred to by a member field until an instance is actually required rather than computing the field value or constructing the referenced object in the class's constructor. Lazy initialization helps to break harmful circularities in class and instance initialization . It also enables other optimizations [Bloch 2005].

...

[API 2006]

 

[Bloch 2001]

Item 48. Synchronize access to shared mutable data

[Bloch 2008]

Item 71. Use lazy initialization judiciously

[JLS 2005]

§12.4, Initialization of Classes and Interfaces

[Pugh 2004]

 

 Manson, Jeremy, Lazy Initialization for Performance
 [Shipilёv 2014] Shipilёv, Aleksey, Safe Publication and Safe Initialization in Java

 

 

...