private static volatile $NAME$ singleton = null;
private $NAME$() {}
public static $NAME$ getInstance() {
if (singleton == null) {
synchronized ($NAME$.class) {
if (singleton == null) {
singleton = new $NAME$();
}
}
}
return singleton;
}
private static volatile $NAME$ singleton = null;
private $NAME$() {}
public static $NAME$ getInstance() {
if (singleton == null) {
synchronized ($NAME$.class) {
if (singleton == null) {
singleton = new $NAME$();
}
}
}
return singleton;
}
本文标题:单例
本文链接:https://www.haomeiwen.com/subject/qybtmctx.html
网友评论