Updated ThreadSafeLazyLoadedivoryTower
Added null check in private constructor to prevent instantiating by Reflection call
This commit is contained in:
		| @@ -33,7 +33,12 @@ public final class ThreadSafeLazyLoadedIvoryTower { | ||||
|  | ||||
|   private static ThreadSafeLazyLoadedIvoryTower instance; | ||||
|  | ||||
|   private ThreadSafeLazyLoadedIvoryTower() {} | ||||
|   private ThreadSafeLazyLoadedIvoryTower() { | ||||
|   // to prevent instantiating by Reflection call | ||||
|     if (instance != null) { | ||||
|       throw new IllegalStateException("Already initialized."); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * The instance gets created only when it is called for first time. Lazy-loading | ||||
|   | ||||
		Reference in New Issue
	
	Block a user