java的双重锁单列模式

public class Singleton {

private  static  Singleton singleton ;


private  static   Singleton     getInstance(){

if(singleton==null){

synchronized (singleton) {

if(singleton==null){
singleton = new Singleton();
}

}

}

return  singleton;
}



}

猜你喜欢

转载自blog.csdn.net/qq_17312239/article/details/80663697
今日推荐