You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2018/12/05 08:29:45 UTC

[incubator-skywalking] 01/01: Fix the alarm being started too many times.

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch alarm-fix
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git

commit 4ba15c2cb4c1606b4eb15038fcf49824135699f8
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Wed Dec 5 16:29:29 2018 +0800

    Fix the alarm being started too many times.
---
 .../oap/server/core/alarm/provider/AlarmModuleProvider.java           | 4 +++-
 .../org/apache/skywalking/oap/server/core/alarm/AlarmEntrance.java    | 1 -
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmModuleProvider.java b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmModuleProvider.java
index 3c228a5..f536caa 100644
--- a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmModuleProvider.java
+++ b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmModuleProvider.java
@@ -46,7 +46,9 @@ public class AlarmModuleProvider extends ModuleProvider {
         }
         RulesReader reader = new RulesReader(applicationReader);
         Rules rules = reader.readRules();
-        this.registerServiceImplementation(IndicatorNotify.class, new NotifyHandler(rules));
+        NotifyHandler notifyHandler = new NotifyHandler(rules);
+        notifyHandler.init(new AlarmStandardPersistence());
+        this.registerServiceImplementation(IndicatorNotify.class, notifyHandler);
     }
 
     @Override public void start() throws ServiceNotProvidedException, ModuleStartException {
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmEntrance.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmEntrance.java
index b2d0e41..207ec3e 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmEntrance.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmEntrance.java
@@ -105,7 +105,6 @@ public class AlarmEntrance {
                     serviceInstanceInventoryCache = moduleManager.find(CoreModule.NAME).provider().getService(ServiceInstanceInventoryCache.class);
                     endpointInventoryCache = moduleManager.find(CoreModule.NAME).provider().getService(EndpointInventoryCache.class);
                     indicatorNotify = moduleManager.find(AlarmModule.NAME).provider().getService(IndicatorNotify.class);
-                    indicatorNotify.init(new AlarmStandardPersistence());
                 }
             } finally {
                 initLock.unlock();