标签:static null get ati private ret 加锁 gets public
单例模式之--懒汉,双重加锁判断
public SingleModel{
private static singleModel singleModel = null ;
private SingleModel{
}
public static SingleModel getSingleModel () {
if ( singleModel == null ) {
synchronized ( SingleModel.class ) {
if ( singleModle == null ) {
singleModel = new SingleModel ();
}
}
}
return singleModel ;
}
}
标签:static null get ati private ret 加锁 gets public
原文地址:http://www.cnblogs.com/up-farm/p/7637425.html