奋斗吧!小蜗牛

导航

单例模式之双重校验锁

public class SingletonDoubleKey { /** * 加volatile得原因:内存模型允许所谓的“无序写入” * singletonDoubleKey = new SingletonDoubleKey(); * 该语句非原子操作,实际是三个步骤。 * 1.给singlet

posted on 2021-02-23 16:57  奋斗的小强  阅读(40)  评论(0编辑  收藏  举报