eEricZeng / gitalk

gitalk plugin repo
https://eericzeng.github.io
Apache License 2.0
0 stars 0 forks source link

设计模式-Singleton Pattern | EricZeng #10

Open eEricZeng opened 5 years ago

eEricZeng commented 5 years ago

https://eericzeng.github.io/2019/07/27/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F-Singleton-Pattern/

线程安全四种线程安全的单例实现方式 饿汉式123456789101112131415161718192021222324252627282930/* 饿汉式单例,在第一次加载类到内存时进行初始化(线程安全)。 <p> <strong>缺点:</strong>非懒加载模式,在实例依赖参数或配置文件时无法使用。 @author zengguan