در ضمن این کلاس الان thread-safe نیست. اگه بخواد باشه، باید synchronization رعایت بشه:

public static syncrhonized MySingleton getInstance() {

// do I exist?

if ( __me == null ) {

// if not, instantiate and store

__me = new MySingleton();

}

return __me;

}


یا از اون بهتر و با performance بالاتر:

private static final Object _lock = new Object();
public static MySingleton getInstance() {

// do I exist?

if ( __me == null ) {
synchronized (_lock) {
if (__me == null) {

// if not, instantiate and store

__me = new MySingleton();
}
}

}

return __me;

}