- 链接地址:https://blog.csdn.net/weixin_44959377/article/details/106890531
- 链接标题:手写单例模式_手写 dcl-CSDN博客
- 所属网站:blog.csdn.net
- 被收藏次数:125
文章浏览阅读137次。懒汉式:太懒了,等到需要的时候才加载。这个不是线程安全的,所以一般用的极少:public class Singleton{ private static Singleton singleton; public static Singleton getInstance(){ if(singleton == null){ singleton = new Singleton(); } return singleton; }}这个是线程安全的,但是synchronized粒度较大_手写 dcl
版权声明:本文发布于特牛网址导航 内容均来源于互联网 如有侵权联系删除
标签:手写 dcl