GUICE 的 singleton 模式写法

public class Singleton {  
  
  static class SingletonHolder {  
    static Singleton instance = new Singleton();  
  }  
  
  public static Singleton getInstance() {  
    return SingletonHolder.instance;  
  }  
  
} 

 参考资料:

 

 http://crazybob.org/2007/01/lazy-loading-singletons.html 
 http://www.oreillynet.com/onjava/blog/2007/01/singletons_and_lazy_loading.html

你可能感兴趣的:(html,Blog)