What is Nostr?
chenzhiguo / 清源
npub14t5…5jn7
2023-02-08 09:04:41
in reply to nevent1q…0eqx

chenzhiguo on Nostr: class Singleton2 { private static volatile Singleton2 singleton2; private ...

class Singleton2 {
private static volatile Singleton2 singleton2;

private Singleton2(){};

public static Singleton2 getInstance() {
if (singleton2 != null) {
return singleton2;
}
synchronized (Singleton2.class) {
singleton2 = new Singleton2();
}
return singleton2;
}
}
这个线程安全吗?
Author Public Key
npub14t5ulke3z0d5gtq6mr2vvu9zszg72fnhfrn36tq7rz0yy0d75xlsch5jn7