From 1950b0635a0db2c5286f8330e064879e020a7303 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 22 十一月 2024 14:02:11 +0800 Subject: [PATCH] 1、通信中间件核心模块线程工作由Thread实现改为Timer实现; 2、完善通信中间件远程升级模块及webRemote模块; 3、优化代码。 --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnit.java | 34 ++++++++++++++++++---------------- 1 files changed, 18 insertions(+), 16 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnit.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnit.java index 6fd31f7..6b3ce51 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnit.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreUnit.java @@ -6,7 +6,8 @@ import com.dy.common.queue.Queue; import com.dy.common.mw.UnitAdapterInterface; import com.dy.common.mw.UnitInterface; -import com.dy.common.mw.UnitStartedCallbackInterface; +import com.dy.common.mw.UnitCallbackInterface; + public class CoreUnit implements UnitInterface { @@ -36,17 +37,14 @@ if(vo == null){ throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄涓嶈兘涓虹┖锛�") ; } - if(vo.sleepBigBusy == null || vo.sleepSmallBusy == null){ + if(vo.coreInterval == null){ throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄闂撮殧灞炴�у�间笉鑳戒负绌猴紒") ; } - if(vo.sleepBigBusy <= 0){ - throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄灞炴�leepBigBusy鍊间笉鑳藉皬浜�0锛�") ; + if(vo.coreInterval <= 0){ + throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄灞炴�oreInterval鍊间笉鑳藉皬浜�0锛�") ; } - if(vo.sleepBigBusy > 1000){ - throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄灞炴�leepBigBusy鍊间笉鑳藉ぇ浜�1000锛�") ; - } - if(vo.sleepSmallBusy > 1000){ - throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄灞炴�leepSmallBusy鍊间笉鑳藉ぇ浜�1000锛�") ; + if(vo.coreInterval > 1000){ + throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄灞炴�oreInterval鍊间笉鑳藉ぇ浜�1000锛�") ; } if(vo.queueWarnSize == null || vo.queueMaxSize == null){ throw new Exception("鏍稿績妯″潡閰嶇疆瀵硅薄闃熷垪鑺傜偣闄愬埗鏁伴噺灞炴�у�间笉鑳戒负绌猴紒") ; @@ -64,28 +62,32 @@ } @Override - public void start(UnitStartedCallbackInterface callback) throws Exception { + public void start(UnitCallbackInterface callback) throws Exception { if(!started){ started = true ; + /* CoreThread ct = CoreThread.getInstance() ; ct.setSleep(this.adapter.getConfig().sleepBigBusy, this.adapter.getConfig().sleepSmallBusy); - ct.start(); - + ct.start(); + */ + CoreTimer ct = CoreTimer.getInstance() ; + ct.setSleep(this.adapter.getConfig().coreInterval); + ct.start(); + CoreConstantManage ccm = CoreConstantManage.getInstance() ; - ccm.setSleep(this.adapter.getConfig().sleepBigBusy, this.adapter.getConfig().sleepSmallBusy); + ccm.setSleep(this.adapter.getConfig().coreInterval); ccm.start(); if(adapter.getConfig().showStartInfo){ System.out.println("鏍稿績妯″潡鎴愬姛鍚姩锛�" - + "涓荤嚎绋嬬箒蹇欓棿闅旓細" + adapter.getConfig().sleepBigBusy + "姣锛�" - + "杞婚棽闂撮殧锛�" + adapter.getConfig().sleepSmallBusy + "姣" ); + + "涓荤嚎绋嬫墽琛岄棿闅旓細" + adapter.getConfig().coreInterval + "姣"); } callback.call(null); } } @Override - public void stop(UnitStartedCallbackInterface callback) { + public void stop(UnitCallbackInterface callback) { } -- Gitblit v1.8.0