Skip to content

Commit

Permalink
单例写法修改,减掉两个方法
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongcang committed Nov 17, 2017
1 parent 1082ed3 commit c78c5af
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion atlas-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repositories {
group = 'com.taobao.android'
description = """atlas_core"""
String postFix = mini=='true' ? "-mini" : "";
version "5.0.8.2-rc1"
version "5.0.7.54-rc2"

String getEnvValue(key, defValue) {
def val = System.getProperty(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,10 @@ public class Atlas {
private Atlas(){
}

private static class SingleTonHolder{
private final static Atlas INSTANCE = new Atlas();
}
private final static Atlas mInstance = new Atlas();

public static Atlas getInstance() {
return SingleTonHolder.INSTANCE;
return mInstance;
}

private BundleLifecycleHandler bundleLifecycleHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,18 @@ public class KernalVersionManager {

public boolean cachePreVersion = false;

private static class SingleTonHolder{
private final static KernalVersionManager INSTANCE = new KernalVersionManager();
}
private volatile static KernalVersionManager mInstance;

public static KernalVersionManager instance(){
return SingleTonHolder.INSTANCE;
if (null == mInstance){
synchronized (KernalVersionManager.class){
if (null == mInstance){
mInstance = new KernalVersionManager();
}
}
}
return mInstance;

}

@Override
Expand Down

0 comments on commit c78c5af

Please sign in to comment.