Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[Android] Android] restart weexCoreThread when reload JSEngine becaus…
Browse files Browse the repository at this point in the history
…e thread maybe in lock state and can't execute reload action (block) (#2824)
  • Loading branch information
lucky-chen authored and Darin726 committed Aug 14, 2019
1 parent ff2c079 commit c72e6b5
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,14 @@ public int callRefreshFinish(String instanceId, String callback) {

}

public void restartWeexCoreThread(){
WXLogUtils.e("weex","restartWeexCoreThread");
WXThread oldThread = mJSThread;
mJSThread = new WXThread("WeexJSBridgeThread", this);
mJSHandler = mJSThread.getHandler();
oldThread.quit();
}

public int callReportCrashReloadPage(String instanceId, String crashFile) {
boolean isCrashFileEmpty = TextUtils.isEmpty(crashFile);
try {
Expand Down Expand Up @@ -914,6 +922,17 @@ public int callReportCrashReloadPage(String instanceId, String crashFile) {
if (WXSDKManager.getInstance().getSDKInstance(instanceId) != null) {
boolean reloadThisInstance = shouldReloadCurrentInstance(
WXSDKManager.getInstance().getSDKInstance(instanceId).getBundleUrl());
boolean restartCoreThread = true;
IWXConfigAdapter adapter = WXSDKManager.getInstance().getWxConfigAdapter();
if (null != adapter){
String config = adapter.getConfig("wxapm","restartCoreThread","true");
restartCoreThread = Boolean.valueOf(config);
}
if (restartCoreThread){
WXBridgeManager.getInstance().restartWeexCoreThread();
}
WXSDKManager.getInstance().getSDKInstance(instanceId).getContainerInfo()
.put("restartWeexCoreThread",String.valueOf(restartCoreThread));
new ActionReloadPage(instanceId, reloadThisInstance).executeAction();
}

Expand Down

0 comments on commit c72e6b5

Please sign in to comment.