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