//java单例模式-懒加载(保证线程安全性)
public static class SingletonOptimizeLazy {
static SingletonOptimizeLazy instance = null;
public static SingletonOptimizeLazy getInstance() {
if (instance == null) {
createInstance();
}
return instance;
}
private synchronized static SingletonOptimizeLazy createInstance() {
if (instance == null) {
instance = new SingletonOptimizeLazy();
}
return instance;
}
}