Creational Design Patterns: Pattern Singleton
Creational Design Patterns: Pattern Singleton
Singleton Pattern
Factory Pattern
Abstract Factory Pattern
Builder Pattern
Prototype Pattern
Pattern Singleton
Singleton is one of the Gangs of Four Design patterns and comes in the
Creational Design Pattern category. Singleton pattern restricts the
instantiation of a class and ensures that only one instance of the class
exists in the Java virtual machine. The singleton class must provide a
global access point to get the instance of the class. Singleton pattern is
used for logging, driver objects, caching and thread pool. Singleton design
pattern is also used in other design patterns like Abstract
Factory, Builder,Prototype, Facade etc. Singleton design pattern is
used in core Java classes also, for
example java.lang.Runtime ,java.awt.Desktop.
To implement Singleton pattern, there are really many approaches but all
of them have following common concepts: