Is Java eager singleton creation thread safe?
问题 I like the simplicity of the eager singleton in java, and most articles about it call its creation thread safe. class Singleton { public static final Singleton instance = new Singleton (); private Singleton (){}; public static Singleton getInstance(){ return instance; } } However I have heard some claims that its creation might not be thread safe after all. For example one source claimed that it is not safe if more than 1 class loader or App domain is used. Is the creation of the Eager