How to write 4 different types of Java singletons with advantages and disadvantages