J. Bloch, in its efficient Java, suggests that we use a singleton enum-based implementation. For instance:
public enum Application { INSTANCE;
This implementation is good for serialization, because enumerations provide us with the ability to serialize by default (and we donβt need to be afraid to get two different instances when deserializing an object).
My question is how this implementation relates to multhreading. How to make it thread safe? What could we get if we try to access it from different threads?
source share