mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-03 04:54:39 +00:00
removed the lazy instantiation from singleton to avoid threading
problems.
This commit is contained in:
1 parent
2552d1b590
commit
d6aed142a7
1 file changed
+1
-4
@@ -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