From 14d7f0df63340ede75458c0e91b902376ef4dd64 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期三, 20 十一月 2024 11:26:32 +0800
Subject: [PATCH] 1、优化代码;2、修改长级测试中发现的bug;3、通信中间件配置文件配置项修改

---
 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeManager.java |   66 +++++++++++++++++++++++----------
 1 files changed, 46 insertions(+), 20 deletions(-)

diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeManager.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeManager.java
index 540e811..09b5f9b 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeManager.java
+++ b/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);
+                }
+            }
         }
     }
 
@@ -179,15 +192,24 @@
             }else{
                 if(!this.task.taskIsOver){
                     //鍗囩骇浠诲姟鏈畬鎴�
-                    //宸ヤ綔1锛氱粺璁″綋鍓嶆鍦ㄥ崌绾х殑RTU鏁伴噺锛屼负鍙楅檺鍚屾椂鍗囩骇鏁伴噺鍋氬噯澶�
-                    this.task.statisticsRunningRtuCount() ;
+                    //宸ヤ綔1锛氬垽鏂槸鍚︽棤浠讳綍涓�涓猂TU杩涜杩囧崌绾э紝骞朵笖杈惧埌鏃堕檺锛屽垯璁や负褰撳墠鍗囩骇浠诲姟瀹屾垚
+                    int temp = this.task.countNoOneRtuUpgrade() ;
+                    if(temp == -1){
+                        this.task.taskIsOver = true ;
+                        //浠诲姟宸茬粡瀹屾垚
+                        this.stop();
+                    }else if(temp == 1){
+                        //宸ヤ綔2锛氱粺璁″綋鍓嶆鍦ㄥ崌绾х殑RTU鏁伴噺锛屼负鍚屾椂鍗囩骇鏁伴噺闄愬埗鍋氬噯澶�
+                        this.task.statisticsRunningRtuCount() ;
 
-                    //宸ヤ綔2锛氱粺璁¢渶瑕佸崌绾т絾褰撳墠绂荤嚎RTU鐨勬儏鍐�
-                    this.task.statisticsOffRtuCountAndSet() ;
+                        //宸ヤ綔3锛氱粺璁¢渶瑕佸崌绾т絾褰撳墠绂荤嚎RTU鐨勬儏鍐�
+                        this.task.statisticsOffRtuCountAndSet() ;
 
-                    //宸ヤ綔3锛氱粺璁℃槸鍚﹀叏閮ㄥ崌绾у畬鎴�
-                    this.task.taskIsOver = this.task.statisticsIsAllOver() ;
-
+                        //宸ヤ綔4锛氱粺璁℃槸鍚﹀叏閮ㄥ崌绾у畬鎴�
+                        this.task.taskIsOver = this.task.statisticsIsAllOver() ;
+                    }else if(temp == 0){
+                        //涓嶄綔涓�
+                    }
                     if(this.task.taskIsOver){
                         if(!this.task.taskOverType.equals(UpgradeTask.TaskOverType_Force)){
                             //浠诲姟涓嶆槸寮哄埗缁撴潫鐨�
@@ -195,16 +217,20 @@
                             this.task.taskOverDt = DateTime.yyyy_MM_dd_HH_mm_ss() ;//浠诲姟瀹屾垚鏃堕棿(yyyy-mm-dd HH:MM:SS)
                         }
                         //浠诲姟瀹屾垚锛屾墽琛屾渶鍚庝竴娆″崌绾х姸鎬侀�氱煡
-                        //宸ヤ綔4锛氬崌绾х姸鎬侀�氱煡
-                        if(!first){
-                            this.notifyUpgradeStatus() ;
-                        }
+                        //宸ヤ綔5锛氬崌绾х姸鎬侀�氱煡
+                        //if(!first){
+                        //    this.notifyUpgradeStatus() ;
+                        //}
                     }else{
                         //浠诲姟鏈畬鎴愶紝缁х画鎵ц鍗囩骇鐘舵�侀�氱煡
-                        //宸ヤ綔4锛� 鍗囩骇鐘舵�侀�氱煡
-                        if(!first){
-                            this.notifyUpgradeStatus() ;
-                        }
+                        //宸ヤ綔5锛� 鍗囩骇鐘舵�侀�氱煡
+                        //if(!first){
+                        //    this.notifyUpgradeStatus() ;
+                        //}
+                    }
+                    //宸ヤ綔5锛氬崌绾х姸鎬侀�氱煡
+                    if(!first){
+                        this.notifyUpgradeStatus() ;
                     }
                 }else{
                     //浠诲姟宸茬粡瀹屾垚

--
Gitblit v1.8.0