mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-15 22:15:02 +00:00
commit
6575b3ae99
2 files changed
+2
-2
No files matched your search
@@ -53,7 +53,7 @@ public final class InitializingOnDemandHolderIdiom {
|
|||||||
* Provides the lazy-loaded Singleton instance.
|
* Provides the lazy-loaded Singleton instance.
|
||||||
*/
|
*/
|
||||||
private static class HelperHolder {
|
private static class HelperHolder {
|
||||||
public static final InitializingOnDemandHolderIdiom INSTANCE =
|
private static final InitializingOnDemandHolderIdiom INSTANCE =
|
||||||
new InitializingOnDemandHolderIdiom();
|
new InitializingOnDemandHolderIdiom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ public final class ThreadSafeLazyLoadedIvoryTower {
|
|||||||
/**
|
/**
|
||||||
* The instance gets created only when it is called for first time. Lazy-loading
|
* The instance gets created only when it is called for first time. Lazy-loading
|
||||||
*/
|
*/
|
||||||
public static synchronized ThreadSafeLazyLoadedIvoryTower getInstance() {
|
public static synchronized ThreadSafeLazyLoadedIvoryTower getInstance() {
|
||||||
|
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new ThreadSafeLazyLoadedIvoryTower();
|
instance = new ThreadSafeLazyLoadedIvoryTower();
|
||||||
|
|||||||
Reference in new issue
Block a user