1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

'v3.7.1.1'

This commit is contained in:
gnosygnu
2016-07-03 22:41:56 -04:00
parent 1a4ca00c0b
commit 36584a0cc2
220 changed files with 4762 additions and 2627 deletions

View File

@@ -44,7 +44,9 @@ public abstract class Xobc_cmd__base implements Xobc_cmd_itm {
@gplx.Virtual public String Cmd_fallback() {return this.Cmd_type();}
@gplx.Virtual public void Cmd_clear() {// called when restarting failed task
this.status = Gfo_prog_ui_.Status__init;
this.cmd_exec_err = null;
this.cmd_exec_err = null; // reset error
this.data_cur = 0; // reset progress else bad progress updates; DATE:2016-06-29
this.Cmd_cleanup(); // do any cleanup, such as deleting bad downloads
}
public void Cmd_exec(Xobc_cmd_ctx ctx) {
@@ -57,20 +59,23 @@ public abstract class Xobc_cmd__base implements Xobc_cmd_itm {
Gfo_log_.Instance.Info("xobc_cmd task end", "task_id", task_id, "step_id", step_id, "cmd_id", cmd_id);
switch (status) {
case Gfo_prog_ui_.Status__suspended: task_mgr.Work_mgr().On_suspended(this); break;
case Gfo_prog_ui_.Status__fail: task_mgr.Work_mgr().On_fail(this, cmd_exec_err); break;
case Gfo_prog_ui_.Status__fail: task_mgr.Work_mgr().On_fail(this, Bool_.N, cmd_exec_err); break;
case Gfo_prog_ui_.Status__working:
this.Prog_notify_and_chk_if_suspended(data_end, data_end); // fire one more time for 100%; note that 100% may not fire due to timer logic below
task_mgr.Work_mgr().On_done(this);
break;
}
} catch (Exception e) {
this.status = Gfo_prog_ui_.Status__fail;
Gfo_log_.Instance.Warn("xobc_cmd task fail", "task_id", task_id, "step_id", step_id, "cmd_id", cmd_id, "err", Err_.Message_gplx_log(e));
task_mgr.Work_mgr().On_fail(this, this.Cmd_fail_resumes(), Err_.Message_lang(e));
}
finally {
Gfo_log_.Instance.Flush();
}
}
protected abstract void Cmd_exec_hook(Xobc_cmd_ctx ctx);
@gplx.Virtual protected boolean Cmd_fail_resumes() {return false;}
protected void Cmd_exec_err_(String v) {
Gfo_log_.Instance.Warn("xobc_cmd task err", "task_id", task_id, "step_id", step_id, "cmd_id", cmd_id, "err", v);
this.status = Gfo_prog_ui_.Status__fail;

View File

@@ -38,6 +38,8 @@ public class Xobc_cmd__download extends Xobc_cmd__base {
@Override public void Cmd_cleanup() {
wkr.Exec_cleanup();
}
@Override protected boolean Cmd_fail_resumes() {return true;}
@Override protected long Load_checkpoint_hook() {
return wkr.Checkpoint__load_by_trg_fil(trg_url);
}

View File

@@ -113,11 +113,12 @@ public class Xobc_task_regy__work extends Xobc_task_regy__base {
step.Cmd_idx_next_();
}
// release wake_lock; will be acquired when task is run_next; DATE:2016-06-29
Xod_power_mgr_.Instance.Wake_lock__rls("task_mgr");
// task_regy.done
if (task_is_done) {
if (this.Len() == 0)
Xod_power_mgr_.Instance.Wake_lock__rls("task_mgr");
else
if (this.Len() > 0)
this.Run_next();
}
// task_regy.work
@@ -132,8 +133,8 @@ public class Xobc_task_regy__work extends Xobc_task_regy__base {
task.Task_status_(Gfo_prog_ui_.Status__suspended);
task_mgr.Send_json("xo.bldr.work.stop_cur__recv", Gfobj_nde.New().Add_int("task_id", task.Task_id()));
}
public void On_fail(Xobc_cmd_itm task, String msg) {
public void On_fail(Xobc_cmd_itm task, boolean resume, String msg) {
Xod_power_mgr_.Instance.Wake_lock__rls("task_mgr");
task_mgr.Send_json("xo.bldr.work.prog__fail__recv", Gfobj_nde.New().Add_int("task_id", task.Task_id()).Add_str("err", msg));
task_mgr.Send_json("xo.bldr.work.prog__fail__recv", Gfobj_nde.New().Add_int("task_id", task.Task_id()).Add_str("err", msg).Add_bool("resume", resume));
}
}