Singleton Pattern with Lazy Initialization On Demand Holder

This is one of the better ways to implementing a singleton class (class which lets user create one and only one instance).

It uses Initialization on demand holder pattern.

public class Singleton {
private static class LazyHolder {
private static final Singleton instance = new Singleton();

public static Singleton getInstance() {
return LazyHolder.instance;

private Singleton() {
//initialize singleton instance


Popular posts from this blog

Resolution for “No buffer space available (maximum connections reached?): JVM_Bind” issue

Using Quartz Scheduler in a Java EE Web Application

Using NPIV port for RDM disk access in VMware vSphere