1// double locking is used to reduce the overhead of the synchronized method
2public static ThreadSafeSingleton getInstanceDoubleLocking() {
3 if (instance == null) {
4 synchronized (ThreadSafeSingleton.class) {
5 if (instance == null) {
6 instance = new ThreadSafeSingleton();
7 }
8 }
9 }
10 return instance;
11}