Re:Safe Publication and Safe Initialization in Java
by nobullet on Sunday September 28, 2014 @05:21PM
(#8380932)
You are right: it would be great to have one good approach. By the way, holder solves the problem when you don't need to pass arguments to singleton instance. In other cases Safe DCL, Safe Local DCL or Synchronized CL will work.
I wish Java had a one-true-way for one-time static initialization like dispatch_once() in Objective-C.