title: How to implement thread-safe lazy initialization?
body: <p>What are some recommended approaches to achieving <strong><em>thread-safe</em></strong> lazy initialization? For instance,</p>
  
  <pre><code>// Not thread-safe
  public Foo getInstance(){
      if(INSTANCE == null){
          INSTANCE = new Foo();
      }
  
      return INSTANCE;
  }
  </code></pre>