|
|
@ -556,6 +556,10 @@ public class AppMaster {
|
|
|
|
int port = jsonObject.optInt("value_int", 0);
|
|
|
|
int port = jsonObject.optInt("value_int", 0);
|
|
|
|
mService.logger.warning("Recv Set CMA Cmd: " + (TextUtils.isEmpty(ip) ? "" : ip) + " port=" + Integer.toString(port));
|
|
|
|
mService.logger.warning("Recv Set CMA Cmd: " + (TextUtils.isEmpty(ip) ? "" : ip) + " port=" + Integer.toString(port));
|
|
|
|
updateCma(ip, port);
|
|
|
|
updateCma(ip, port);
|
|
|
|
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_SET_APP_HB)) {
|
|
|
|
|
|
|
|
int hb = jsonObject.optInt("value_int", 0);
|
|
|
|
|
|
|
|
mService.logger.warning("Recv Set HB Duration Cmd: " " duration=" + Integer.toString(hb));
|
|
|
|
|
|
|
|
updateHeartbeatDuration(hb);
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_SET_MNTN)) {
|
|
|
|
} else if (TextUtils.equals(cmd, CMD_SET_MNTN)) {
|
|
|
|
String ip = jsonObject.optString("value_str", null);
|
|
|
|
String ip = jsonObject.optString("value_str", null);
|
|
|
|
int port = jsonObject.optInt("value_int", 0);
|
|
|
|
int port = jsonObject.optInt("value_int", 0);
|
|
|
@ -923,6 +927,28 @@ public class AppMaster {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean updateHeartbeatDuration(int duration) {
|
|
|
|
|
|
|
|
if (duration <= 0) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final Context context = mService.getApplicationContext();
|
|
|
|
|
|
|
|
MicroPhotoContext.AppConfig appConfig = MicroPhotoContext.getMpAppConfig(context);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (duration == appConfig.heartbeat) {
|
|
|
|
|
|
|
|
mService.logger.info("New HB Duration is not changed");
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
appConfig.heartbeat = duration;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MicroPhotoContext.saveMpAppConfig(context, appConfig);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MicroPhotoContext.restartMpApp(mService.getApplicationContext());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void upgradeApp(long cid, String action, String url) {
|
|
|
|
private void upgradeApp(long cid, String action, String url) {
|
|
|
|
|
|
|
|
|
|
|
|
mService.logger.warning("Recv Upgrade Cmd: url=" + url);
|
|
|
|
mService.logger.warning("Recv Upgrade Cmd: url=" + url);
|
|
|
|