单例模式
qzqanlhy1314
这个作者很懒,什么都没留下…
展开
-
java 单例模式,双锁检测,枚举
双锁检测 public class Singleton { private static volatile Singleton singleton; private Singleton() {} public static Singleton getInstance() { if (singleton == null) { ...原创 2018-11-21 14:54:16 · 304 阅读 · 0 评论 -
java 单例模式 使用静态内部类实现
public class YamlReadUtils{ private YamlReadUtils() { if (SingletonHolder.instance != null) { throw new IllegalStateException(); } } /** * use static inner class achieve singleton ...原创 2018-11-20 09:59:25 · 325 阅读 · 0 评论 -
java 读取property 配置文件
import java.io.IOException; import java.io.InputStreamReader; import java.util.Properties; /** * Property read tools */ public class PropertyReader { private volatile static PropertyReader in...原创 2018-11-20 14:23:09 · 689 阅读 · 0 评论