View on GitHub

example-java-design-patterns

In singleton pattern, a class has only one instance and provide a global access point to it.

The singleton pattern encapsulates “just-in-time initialization” or “initialization on first use”.

Care should be taken in singleton instance availability check and resule to avoid repeated instance creation from concurrent threads.