removed the lazy instantiation from singleton to avoid threading

problems.
This commit is contained in:
yusufaytas 2014-09-07 21:21:24 +01:00
parent 2552d1b590
commit d6aed142a7

View File

@ -7,14 +7,11 @@ package com.iluwatar;
*/ */
public class IvoryTower { public class IvoryTower {
private static IvoryTower instance; private static IvoryTower instance = new IvoryTower();
private IvoryTower() {} private IvoryTower() {}
public static IvoryTower getInstance() { public static IvoryTower getInstance() {
if(instance == null){
instance = new IvoryTower();
}
return instance; return instance;
} }
} }