线程安全的懒汉式单例模式

在单例模式中分为懒汉式和饿汉式,其中饿汉式是线程安全的,要实现懒汉式线程安全要作双重的判断,其中代码以下:web public static class Singleton(){ private volatile static Singleton instance=null; private Singleton(){ } public static Singleton getInstanc
相关文章
相关标签/搜索