Java中的双重检查锁double checked locking加锁双重检查锁
在实现单例模式时,如果未考虑多线程的情况,就容易写出下面的错误代码:public class Single { private static Single instance; private Single() { } public Singleton getInstance() { if (null == instance) { ...