From 6c77dacffe782a05c0468e344322d5b5d155001e Mon Sep 17 00:00:00 2001 From: lknan <40596486+lknan@users.noreply.github.com> Date: Fri, 24 Dec 2021 20:38:17 +0800 Subject: [PATCH 1/2] Update RepeaterModule.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复console后台刷新节点,导致订阅器重复问题 --- .../jvm/sandbox/repeater/module/RepeaterModule.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/repeater-module/src/main/java/com/alibaba/jvm/sandbox/repeater/module/RepeaterModule.java b/repeater-module/src/main/java/com/alibaba/jvm/sandbox/repeater/module/RepeaterModule.java index 397601ba..426e9bb7 100644 --- a/repeater-module/src/main/java/com/alibaba/jvm/sandbox/repeater/module/RepeaterModule.java +++ b/repeater-module/src/main/java/com/alibaba/jvm/sandbox/repeater/module/RepeaterModule.java @@ -93,6 +93,8 @@ public class RepeaterModule implements Module, ModuleLifecycle { private HeartbeatHandler heartbeatHandler; private AtomicBoolean initialized = new AtomicBoolean(false); + + private static List subscribes = new ArrayList <>(); @Override public void onLoad() throws Throwable { @@ -186,8 +188,11 @@ private synchronized void initialize(RepeaterConfig config) { } } RepeaterBridge.instance().build(repeaters); + // 先卸载消息订阅器 + subscribes.forEach(subscribe -> subscribe.unRegister()); + subscribes.clear(); // 装载消息订阅器 - List subscribes = lifecycleManager.loadSubscribes(); + subscribes = lifecycleManager.loadSubscribes(); for (SubscribeSupporter subscribe : subscribes) { subscribe.register(); } From 1804646257cd3ea375b28da9c475a5c61cedda7f Mon Sep 17 00:00:00 2001 From: lknan <40596486+lknan@users.noreply.github.com> Date: Fri, 24 Dec 2021 21:09:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E6=8E=A8=E9=80=81=E4=B8=8D=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E7=94=9F=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复console配置点击推送时,新的配置不会实时变更的问题, --- .../jvm/sandbox/repeater/plugin/java/JavaEntrancePlugin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repeater-plugins/java-plugin/src/main/java/com/alibaba/jvm/sandbox/repeater/plugin/java/JavaEntrancePlugin.java b/repeater-plugins/java-plugin/src/main/java/com/alibaba/jvm/sandbox/repeater/plugin/java/JavaEntrancePlugin.java index 405207f3..7687eef2 100644 --- a/repeater-plugins/java-plugin/src/main/java/com/alibaba/jvm/sandbox/repeater/plugin/java/JavaEntrancePlugin.java +++ b/repeater-plugins/java-plugin/src/main/java/com/alibaba/jvm/sandbox/repeater/plugin/java/JavaEntrancePlugin.java @@ -67,10 +67,10 @@ public void onConfigChange(RepeaterConfig config) throws PluginLifeCycleExceptio if (configTemporary == null) { super.onConfigChange(config); } else { - this.config = config; - super.onConfigChange(config); List current = config.getJavaEntranceBehaviors(); List latest = configTemporary.getJavaEntranceBehaviors(); + this.config = config; + super.onConfigChange(config); if (JavaPluginUtils.hasDifference(current, latest)) { reWatch0(); }