From 9c58ad1bbcff068694ea2fcd7fea468bf445a4d3 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期四, 13 二月 2025 16:04:08 +0800 Subject: [PATCH] 通信中间件,启用消息推送测试代码 --- pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/upgrade/UpgradeManager.java | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 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 bd52b71..9caed79 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 @@ -25,13 +25,15 @@ private static final UpgradeManager INSTANCE = new UpgradeManager(); + private Boolean openNoUpgrade ;//闃�寮�锛堟车寮�锛変笉鎵ц鍗囩骇 + private Integer lastOpenMaxGoOn ;//闃�寮�锛堟车寮�锛夌姸鎬佽缃互鏉ユ寔缁渶闀挎椂闂达紙绉掗挓锛夛紝瓒呰繃杩欎釜鏃堕棿璁や负鐘舵�佹棤鏁堬紙杩欎釜鏃堕暱鍙栧喅浜庡伐浣滄姤闂撮殧锛� private Integer failTryTimes ;//鍗囩骇澶辫触鍚庯紝閲嶆柊鍋胯瘯鍗囩骇娆℃暟锛�0琛ㄧず涓嶉噸鏂板伩璇曞崌绾� private Integer ugMaxRtuSameTime ;//鍚屾椂鍗囩骇RTU鏈�澶т釜鏁� private Integer notifyTimesAfterOver; //鍗囩骇缁撴潫鍚庯紝鍐嶅悜web鏈嶅姟绯荤粺閫氱煡鐘舵�佺殑娆℃暟 private int nowNotifyTimesAfterOver; //鍗囩骇缁撴潫鍚庯紝鍐嶅悜web鏈嶅姟绯荤粺閫氱煡鐘舵�佺殑娆℃暟 private UpgradeTask task ;//鍗囩骇浠诲姟 - private boolean monitorFirst = true ;//鏄惁鏄涓�娆$洃瑙� + private boolean monitorFirst ;//鏄惁鏄涓�娆$洃瑙� private UpgradeManager(){ monitorFirst = true ; @@ -45,6 +47,8 @@ * 鍒濆鍖栭厤缃俊鎭� */ public void initOption(UpgradeUnitConfigVo configVo) { + this.openNoUpgrade = configVo.openNoUpgrade; + this.lastOpenMaxGoOn = configVo.lastOpenMaxGoOn; this.failTryTimes = configVo.failTryTimes; this.ugMaxRtuSameTime = configVo.ugMaxRtuAtOnce; this.notifyTimesAfterOver = configVo.notifyTimesAfterOver; @@ -65,9 +69,10 @@ this.task.forceOver(); } this.task = new UpgradeTask(); - this.task.initOption(this.failTryTimes, this.ugMaxRtuSameTime); + this.task.initOption(this.openNoUpgrade, this.lastOpenMaxGoOn, this.failTryTimes, this.ugMaxRtuSameTime); this.task.setTask(vo); this.nowNotifyTimesAfterOver = 0 ; + this.monitorFirst = true ; log.info("======================================================") ; log.info("= =") ; log.info("=璁剧疆浜嗗崌绾т换鍔★紝娑夊強RTU" + vo.rtuAddrList.size() + "鍙� =") ; @@ -115,9 +120,9 @@ * @param protocolVersion 涓婅鏁版嵁瀵瑰簲鐨勫崗璁増鏈彿 * @param callbackCom 鍥炶皟鍑芥暟锛屽鐞嗕笅琛屽懡浠� */ - public void trigger(String rtuAddr, String code, String protocolName, Short protocolVersion, Callback callbackCom){ + public void trigger(String rtuAddr, String code, String protocolName, Short protocolVersion, Callback callbackCom, Object ...objects){ if(task != null && !task.taskIsOver){ - this.task.trigger(rtuAddr, code, protocolName, protocolVersion, callbackCom); + this.task.trigger(rtuAddr, code, protocolName, protocolVersion, callbackCom, objects); } } @@ -195,6 +200,12 @@ this.stop() ; }else{ if(!this.task.taskIsOver){ + if(this.openNoUpgrade != null + && this.openNoUpgrade.booleanValue() + && this.monitorFirst){ + //绗竴娆¤繘鍏ワ紝杩涜闃�寮�涓嶅崌绾у鐞� + this.task.openNoUpgrade() ; + } this.nowNotifyTimesAfterOver = 0 ; //鍗囩骇浠诲姟鏈畬鎴� //宸ヤ綔1锛氬垽鏂槸鍚︽棤浠讳綍涓�涓猂TU杩涜杩囧崌绾э紝骞朵笖杈惧埌鏃堕檺锛屽垯璁や负褰撳墠鍗囩骇浠诲姟瀹屾垚 @@ -309,6 +320,7 @@ return true ; } + /** * 鍗囩骇鐘舵�侀�氱煡 */ -- Gitblit v1.8.0