# Singleton Design Pattern

  • Singleton pattern is a design pattern which restricts a class to instantiate its multiple objects.
  • Singleton classes are used for logging, driver objects, caching and thread pool, database connections.

Description

# Implementation methods

  1. Classic Implementation
  2. Make getInstance() synchronized
  3. Eager Instantiation
  4. Double Checked Locking

code(opens new window)

Last Updated: 11/21/2020, 9:42:13 AM