What makes you say that either a singleton or a static method isn't thread-safe?
(是什么让您说单例或静态方法不是线程安全的?)
Usually both should be implemented to be thread-safe. (通常,两者都应实现为线程安全的。)
The big difference between a singleton and a bunch of static methods is that singletons can implement interfaces (or derive from useful base classes, although that's less common, in my experience), so you can pass around the singleton as if it were "just another" implementation.
(单例和一堆静态方法之间的最大区别在于,单例可以实现接口(或从有用的基类派生,尽管根据我的经验,这种情况不那么常见),因此您可以将单例当作“只是另一个实施。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…