liurunyu
2024-11-19 37ad41fcac6e1e465db4f9bca397f1e26baa66ab
修改设备升级任务实现算法,使其运行更安全
2个文件已修改
35 ■■■■ 已修改文件
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeManager.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeManager.java
@@ -53,11 +53,24 @@
        if(this.task != null && !this.task.taskIsOver){
            throw new Exception("当前存在升级任务,请等待当前任务执行完或强制结束当前任务");
        }else {
            this.task.forceOver();
            this.task = new UpgradeTask();
            this.task.initOption(this.failTryTimes, this.ugMaxRtuSameTime);
            this.task.setTask(vo);
            this.start(this);
            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);
                }
            }
        }
    }
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeTask.java
@@ -175,11 +175,13 @@
     * 强制结束升级任务
     */
    public void forceOver(){
        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();
        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();
        }
    }
    /**