Skip to content

Commit

Permalink
removed the lazy instantiation from singleton to avoid threading
Browse files Browse the repository at this point in the history
problems.
  • Loading branch information
yusufaytas committed Sep 7, 2014
1 parent 2552d1b commit d6aed14
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions singleton/src/main/java/com/iluwatar/IvoryTower.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@
*/
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;
}
}

0 comments on commit d6aed14

Please sign in to comment.