removed the lazy instantiation from singleton to avoid threading
problems.
This commit is contained in:
@ -7,14 +7,11 @@ package com.iluwatar;
|
||||
*/
|
||||
public class IvoryTower {
|
||||
|
||||
private static IvoryTower instance;
|
||||
private static IvoryTower instance = new IvoryTower();
|
||||
|
||||
private IvoryTower() {}
|
||||
|
||||
public static IvoryTower getInstance() {
|
||||
if(instance == null){
|
||||
instance = new IvoryTower();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user