Why Nostr? What is Njump?
2023-02-08 08:46:32
in reply to

dave on Nostr: ...

这段代码是线程安全的。由于singleton1是静态变量,在getInstance()方法创建之前就已经创建了,所以在多线程环境下,getInstance()只会返回同一个实例,从而保证单例模式的线程安全性。
Author Public Key
npub1tsgw6pncspg4d5u778hk63s3pls70evs4czfsmx0fzap9xwt203qtkhtk4