Loading core/java/android/util/Singleton.java +9 −5 Original line number Diff line number Diff line Loading @@ -33,17 +33,21 @@ public abstract class Singleton<T> { } @UnsupportedAppUsage private T mInstance; private volatile T mInstance; protected abstract T create(); @UnsupportedAppUsage public final T get() { T instance = mInstance; if (instance == null) { synchronized (this) { if (mInstance == null) { mInstance = create(); } return mInstance; instance = mInstance; } } return instance; } } Loading
core/java/android/util/Singleton.java +9 −5 Original line number Diff line number Diff line Loading @@ -33,17 +33,21 @@ public abstract class Singleton<T> { } @UnsupportedAppUsage private T mInstance; private volatile T mInstance; protected abstract T create(); @UnsupportedAppUsage public final T get() { T instance = mInstance; if (instance == null) { synchronized (this) { if (mInstance == null) { mInstance = create(); } return mInstance; instance = mInstance; } } return instance; } }