mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-14 14:58:39 +00:00
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