The answer to the singleton question-of-the-week has been corrected, but
I'm wondering if the correction is thread-safe. Is a synchronized
getInstance method or a HelperSingleton needed? Or is the following OK?
http://developer.java.sun.com/developer/qow/archive/111/index.html
public class Singleton {
private static final Singleton INSTANCE =
new Singleton();
// Private constructor supresses
// default public constructor
private Singleton( ) {
}
public static Singleton getInstance( ) {
return INSTANCE;
}
}
-- Joe Bowbeer------------------------------- JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:28 EDT