摘要: 设计模式中的单例模式的懒汉方式会存在多线程的安全问题;通过以下测试代码可以看到两个线程中得到的并不是同一个单例对象; ``` @Test public void unsafeSingleInstanceTest() throws InterruptedException { AtomicRefere 阅读全文
posted @ 2023-07-11 21:37 无风听海 阅读(6) 评论(0) 推荐(0) 编辑