奋斗吧!小蜗牛

导航

2021年2月23日 #

单例模式之双重校验锁

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

posted @ 2021-02-23 16:57 奋斗的小强 阅读(40) 评论(0) 推荐(0) 编辑