[...] the recommended way to write
Singleton pattern in Java is using
enum [...]
Honestly, I do not know where this recommendation comes from, but it is certainly flawed. Above all because serialization of enums in Java is totally different than serialization of an ordinary classes.
When a enum is serialized, only its name is written into the stream, basically because it is expected that the nature of the enum is entirely static. When the enum is deserialized, it is built again based on Enum.valueOf(name).
This implies that if you use a enum as a singleton, and if your singleton is not entirely static, namingly it has dynamic state, then if you serialize it then you are up for some interesting bugs.
This implies that enums cannot always be the solution, although sometimes they could be a good approach.
It seems that what you want to accomplish is to ensure a unique instance of the ResourceBundle, not sure if having two instances of it would affect your application in any possible way, but at any rate, the ResourceBundle as it is implemented by the JDK already caches resource bundle instances.
The Javadocs say:
All resource bundles loaded are cached by default.
This means that if you try to get the same resource bundle twice you get the same instance provided that the cache has not yet been invalidated:
ResourceBundle resource1 = ResourceBundle.getBundle("test");
ResourceBundle resource2 = ResourceBundle.getBundle("test");
assert resource1==resource2;
If you intention is saving some memory, then you do not need a singleton mechanism. The provided cache can do the trick for you.
I am not an expert on the subject, but if you take a look at the ResourceBundle Javadocs perhaps you can find a better way to deal with the resource bundle other than within this enum singlenton.