1 Star 7 Fork 2

蔚蔚樱软件开发/AlgoHub

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
LazySingle.java 732 Bytes
一键复制 编辑 原始数据 按行查看 历史
ljfirst 提交于 2022-10-31 23:58 +08:00 . feat: update
package DesignPattern.single;
/**
* @author 蔚蔚樱
* @version 1.0
* @date 2020-02-17 18:24
* @Email micromicrohard@outlook.com
* @description LazySinglePattren means delayed loading,
* but exist thread safety problem.
* So use synchronized to solve this problem,
* but still exist performance problem.
* @blogURL
*/
public class LazySingle implements Singletom {
private static LazySingle lazySinglePattren = null;
private LazySingle() {
}
public static LazySingle getlLazySinglePattren() {
synchronized (LazySingle.class) {
if (lazySinglePattren == null) {
lazySinglePattren = new LazySingle();
}
}
return lazySinglePattren;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/micromicrohard/algo-hub.git
git@gitee.com:micromicrohard/algo-hub.git
micromicrohard
algo-hub
AlgoHub
master

搜索帮助