mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-05 12:14:18 +00:00
1 parent
c741814b36
commit
4e8cdc7c96
1 file changed
+1
-5
@@ -44,13 +44,9 @@ public final class ThreadSafeLazyLoadedIvoryTower {
|
|||||||
* The instance doesn't get created until the method is called for the first time.
|
* The instance doesn't get created until the method is called for the first time.
|
||||||
*/
|
*/
|
||||||
public static synchronized ThreadSafeLazyLoadedIvoryTower getInstance() {
|
public static synchronized ThreadSafeLazyLoadedIvoryTower getInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
synchronized (ThreadSafeLazyLoadedIvoryTower.class) {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new ThreadSafeLazyLoadedIvoryTower();
|
instance = new ThreadSafeLazyLoadedIvoryTower();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user