removed the lazy instantiation from singleton to avoid threading
problems.
This commit is contained in:
parent
2552d1b590
commit
d6aed142a7
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user