| | |
| | | if(this.task != null && !this.task.taskIsOver){ |
| | | throw new Exception("当前存在升级任务,请等待当前任务执行完或强制结束当前任务"); |
| | | }else { |
| | | Exception ex = null ; |
| | | try{ |
| | | if(this.task != null){ |
| | | this.task.forceOver(); |
| | | } |
| | | this.task = new UpgradeTask(); |
| | | this.task.initOption(this.failTryTimes, this.ugMaxRtuSameTime); |
| | | this.task.setTask(vo); |
| | | }catch (Exception e){ |
| | | ex = e ; |
| | | }finally { |
| | | if(ex != null){ |
| | | this.task = null ; |
| | | throw ex ; |
| | | }else{ |
| | | this.start(this); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 结束当前升级任务 |
| | |
| | | * 强制结束升级任务 |
| | | */ |
| | | public void forceOver(){ |
| | | if(!this.taskIsOver){ |
| | | this.taskIsOver = true ;//强制设置任务完成 |
| | | this.taskOverType = TaskOverType_Force ;//任务完成方式(自然,强制) |
| | | this.taskOverDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;//任务完成时间(yyyy-mm-dd HH:MM:SS) |
| | | //this.taskVo.rtuAddrList.clear(); |
| | | //this.upgradeState.clear(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 当前升级状态 |