
Singleton
文章平均质量分 85
一个被IT搞的
这个作者很懒,什么都没留下…
展开
-
C# 单例模式整理
参考: 《Implementing the Singleton Pattern in C#》 《CLR via C# (第4版)》 方式1. 非线程安全 public class Singleton { private static Singleton instance = null; private Singleton() { } pub原创 2017-04-06 15:54:00 · 308 阅读 · 0 评论 -
Java 双检锁问题
来源:《The "Double-Checked Locking is Broken" Declaration》 1. 单例模式的简单实现 // 只支持单线程的版本 class Foo { private Helper helper = null; public Helper getHelper() { if (helper == null)原创 2017-04-06 15:55:32 · 693 阅读 · 0 评论