Tag: designpatterns

Singletons with Initialization Methods

The singleton design pattern guarantees that only one instance of a given class will be constructed. But, how can we address any exceptions that get thrown while this instance is being created? In today’s post, we’ll show how this issue can be solved using a special singleton initialization method, along with Java’s standard IllegalStateException class.