Breaking Singleton using reflection and Enum Singleton
This is our fifth article in the series of Singleton Design Pattern. The purpose of the singleton class is to control object creation, limiting the number of objects to only one. In our previous articles, we have discussed how we can create Singleton Design Pattern in Single-threaded and multithreaded environment. We have also discussed how we can […]
Preventing Cloning in Singleton Design Pattern
This is our third article on Singleton Design Pattern. The purpose of the singleton class is to control object creation, limiting the number of objects to only one. In our previous two articles, we have discussed how we can create Singleton Design Pattern in Single-threaded and multithreaded environment. In this article, we will discuss how we can […]
Serialization and Singleton Design Pattern
This is our forth article in the series of Singleton Design Pattern Articles. The purpose of the singleton class is to control object creation, limiting the number of objects to only one. In our previous three articles, we have discussed how we can create Singleton Design Pattern in Single-threaded and multithreaded environment. We have also discussed how […]
Singleton Design Pattern Using Double Checked Locking
This is our second article in the series of Singleton Design Pattern. In this article, we will see different thread safe approaches for lazy Initialization Singleton Design Pattern like Using Synchronized getInstance() method, Double checked locking approach and Bill Pugh Implementation using Inner class. For navigating to the other articles on Singleton Design Pattern, please refer table of contents on the right […]
Singleton Design Pattern
In Design Pattern article, we have seen different types of design patterns. In this article, we will understand one of the simplest Creational Design Pattern i.e. Singleton Design Pattern. What is the purpose of Singleton? The purpose of the singleton class is to control object creation, limiting the number of objects to only one. The singleton allows only […]