From ab6421bcf7b480f9955b6b4376554ec9677e71ed Mon Sep 17 00:00:00 2001 From: awudzins Date: Mon, 13 Jan 2020 11:43:08 +0100 Subject: Changed EventTransformation schema to be loaded only once Issue-ID: DCAEGEN2-1774 Signed-off-by: adamwudzinski Change-Id: I50f3da2c11201a40be948ab199aaca89bbbb38db --- src/main/java/org/onap/dcae/VesApplication.java | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/main/java/org/onap/dcae/VesApplication.java') diff --git a/src/main/java/org/onap/dcae/VesApplication.java b/src/main/java/org/onap/dcae/VesApplication.java index e3340820..bc5b1a8f 100644 --- a/src/main/java/org/onap/dcae/VesApplication.java +++ b/src/main/java/org/onap/dcae/VesApplication.java @@ -3,6 +3,7 @@ * PROJECT * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2020 Nokia. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +48,7 @@ public class VesApplication { private static final Logger incomingRequestsLogger = LoggerFactory.getLogger("org.onap.dcae.common.input"); private static final Logger oplog = LoggerFactory.getLogger("org.onap.dcae.common.output"); private static final Logger errorLog = LoggerFactory.getLogger("org.onap.dcae.common.error"); - private static ApplicationSettings properties; + private static ApplicationSettings applicationSettings; private static ConfigurableApplicationContext context; private static ConfigLoader configLoader; private static ScheduledThreadPoolExecutor scheduledThreadPoolExecutor; @@ -57,7 +58,7 @@ public class VesApplication { public static void main(String[] args) { app = new SpringApplication(VesApplication.class); - properties = new ApplicationSettings(args, CLIUtils::processCmdLine); + applicationSettings = new ApplicationSettings(args, CLIUtils::processCmdLine); scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(1); init(); app.setAddCommandLineProperties(true); @@ -68,7 +69,7 @@ public class VesApplication { public static void restartApplication() { Thread thread = new Thread(() -> { context.close(); - properties.reloadProperties(); + applicationSettings.reloadProperties(); scheduleFeatures.cancel(true); init(); context = SpringApplication.run(VesApplication.class); @@ -89,32 +90,32 @@ public class VesApplication { private static void createSchedulePoolExecutor() { scheduleFeatures = scheduledThreadPoolExecutor.scheduleAtFixedRate(configLoader::updateConfig, - properties.configurationUpdateFrequency(), - properties.configurationUpdateFrequency(), + applicationSettings.configurationUpdateFrequency(), + applicationSettings.configurationUpdateFrequency(), TimeUnit.MINUTES); } private static void createConfigLoader() { configLoader = ConfigLoader.create(getEventPublisher()::reconfigure, - Paths.get(properties.dMaaPConfigurationFileLocation()), - properties.configurationFileLocation()); + Paths.get(applicationSettings.dMaaPConfigurationFileLocation()), + applicationSettings.configurationFileLocation()); } private static EventPublisher getEventPublisher() { return EventPublisher.createPublisher(oplog, DMaaPConfigurationParser - .parseToDomainMapping(Paths.get(properties.dMaaPConfigurationFileLocation())).get()); + .parseToDomainMapping(Paths.get(applicationSettings.dMaaPConfigurationFileLocation())).get()); } private static Map getDmapConfig() { return DMaaPConfigurationParser - .parseToDomainMapping(Paths.get(properties.dMaaPConfigurationFileLocation())).get(); + .parseToDomainMapping(Paths.get(applicationSettings.dMaaPConfigurationFileLocation())).get(); } @Bean @Lazy public ApplicationSettings applicationSettings() { - return properties; + return applicationSettings; } @Bean @@ -132,7 +133,7 @@ public class VesApplication { @Bean @Qualifier("eventSender") public EventSender eventSender() { - return new EventSender(eventPublisher,properties); + return new EventSender(eventPublisher, applicationSettings); } } -- cgit 1.2.3-korg