- /**
- * 懒汉单例模式创新(线程安全)
- * 只有在调用的时候才会初始化
- */
- public class LazySuperSingleton {
- static class SingletonHolder {
- static LazySuperSingleton instance = new LazySuperSingleton();
- }
- public static LazySuperSingleton getInstance() {
- return SingletonHolder.instance;
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/281020136724.html
来源: http://www.codesnippet.cn/detail/281020136724.html