1 Star 7 Fork 2

蔚蔚樱软件开发/AlgoHub

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Singletom.java 812 Bytes
一键复制 编辑 原始数据 按行查看 历史
ljfirst 提交于 2022-10-31 23:58 +08:00 . feat: update
package DesignPattern.single;
/**
* @author 蔚蔚樱
* @version 1.0
* @date 2020-02-17 18:30
* @Email micromicrohard@outlook.com
* @description
* single pattern desing for this situation:just provider an instance for Class.
* @HungrySinglePattern creates an instance object when
* *the class is loaded, but there is no delay in loading.
* *In order to solve this problem, {@LazySinglePattren} is introduced,
* *although the load can be delayed, but the thread is unsafe.
* *In order to solve the thread security problem,
* *the synchronized keyword is introduced.
* *But there is a performance problem, more time-consuming,
* *finally , the {@inner-class} is a perfect solution.
* *
* *Attention:Experiments show that the double locks is faster
* @blogURL:
*/
public interface Singletom {
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/micromicrohard/algo-hub.git
git@gitee.com:micromicrohard/algo-hub.git
micromicrohard
algo-hub
AlgoHub
master

搜索帮助