【发布时间】:2015-10-30 03:03:12
【问题描述】:
关于我提出的previous question,
public static Singleton getInstanceDC() {
if (_instance == null) { // Single Checked (1)
synchronized (Singleton.class) {
if (_instance == null) { // Double checked (2)
_instance = new Singleton();
}
}
}
return _instance;
}
为什么要使用第二个实例空检查条件。可能会产生什么影响?
【问题讨论】:
标签: java double-checked-locking