摘要: 一、单例模式的DCL为啥要加volatile? 避免指令重排,获取到未初始化完成的对象。 单例模式的懒汉模式确保线程安全的机制DCL public class MyTest { private static MyTest myTest; public static MyTest getInstanc 阅读全文
posted @ 2024-06-24 11:03 northli 阅读(1) 评论(0) 推荐(0) 编辑