拥有一个在其静态构造函数中接受参数的单例是个好主意吗?我可以有并发问题吗?
public class DataHelper {
private static DataHelper singleton = null;
private Listener<Object> listener;
public static DataHelper getInstance(Listener<Object> listener) {
if(singleton == null) {
singleton = new DataHelper();
}
singleton.listener = listener;
return singleton;
}
}