From cab74c538b053cca4279aed6f7a8c32d7497f6bd Mon Sep 17 00:00:00 2001 From: Guangrong Fu Date: Mon, 30 Oct 2017 22:27:42 +0800 Subject: Change the logic of Service Registration Change-Id: I9714c94dad458f7cf0d00126934ae76dd2896716 Issue-ID: HOLMES-81 Signed-off-by: Guangrong Fu --- rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java | 8 ++++---- .../org/onap/holmes/rulemgt/dcae/DcaeConfigurationPolling.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java index 2b8f986..01fde48 100644 --- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java @@ -48,16 +48,16 @@ public class RuleActiveApp extends IOCApplication { public void run(RuleAppConfig configuration, Environment environment) throws Exception { super.run(configuration, environment); - ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); - service.scheduleAtFixedRate(new DcaeConfigurationPolling("holmes-rule-mgmt"), 0, - DcaeConfigurationPolling.POLLING_PERIOD, TimeUnit.MILLISECONDS); - environment.jersey().register(new RuleMgtResources()); try { new MSBRegisterUtil().register2Msb(createMicroServiceInfo()); } catch (CorrelationException e) { log.warn(e.getMessage(), e); } + + ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); + service.scheduleAtFixedRate(new DcaeConfigurationPolling("holmes-rule-mgmt"), 0, + DcaeConfigurationPolling.POLLING_PERIOD, TimeUnit.MILLISECONDS); } private MicroServiceInfo createMicroServiceInfo() { diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPolling.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPolling.java index c9fdb70..4aa98ee 100644 --- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPolling.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPolling.java @@ -52,7 +52,7 @@ public class DcaeConfigurationPolling implements Runnable { try { dcaeConfigurations = DcaeConfigurationQuery.getDcaeConfigurations(hostname); } catch (CorrelationException e) { - log.error("Failed to fetch DCAE configurations" + e.getMessage()); + log.error("Failed to fetch DCAE configurations. " + e.getMessage()); } if (dcaeConfigurations != null) { RuleQueryListResponse ruleQueryListResponse = getAllCorrelationRules(); @@ -61,7 +61,7 @@ public class DcaeConfigurationPolling implements Runnable { try { addAllCorrelationRules(dcaeConfigurations); } catch (CorrelationException e) { - log.error("Failed to add rules" + e.getMessage()); + log.error("Failed to add rules. " + e.getMessage()); } } } -- cgit 1.2.3-korg