diff options
author | Jakub Zieba <jakub.zieba@nokia.com> | 2018-08-28 14:07:56 +0200 |
---|---|---|
committer | Jakub Zieba <jakub.zieba@nokia.com> | 2018-08-29 13:09:46 +0200 |
commit | 4fbb9e8ad097c9ec3c3434ba257e887fb3a64699 (patch) | |
tree | b244acb1fd41b987afd514205636f16fe6d5e76e /prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java | |
parent | 5b4e3b195960af161604eccb1c1c805bb91c6648 (diff) |
Revert web server to prh, fix configuration
Revert web server to prh, becaue it is used by health check
Fix cloud configuration fetching
Additional code refactoring
Change-Id: Ic3d6f4c266064436e2701ec3ef3a7534b2d5b8b4
Issue-ID: DCAEGEN2-696
Signed-off-by: Jakub Zieba <jakub.zieba@nokia.com>
Diffstat (limited to 'prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java')
-rw-r--r-- | prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java index c53d3333..a27feefb 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java @@ -33,8 +33,10 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.concurrent.ConcurrentTaskScheduler; +import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import reactor.core.publisher.Mono; /** @@ -42,7 +44,7 @@ import reactor.core.publisher.Mono; */ @Configuration @EnableScheduling -public class SchedulerConfig extends CloudConfiguration { +public class SchedulerConfig { private static final int SCHEDULING_DELAY_FOR_PRH_TASKS = 5; private static final int SCHEDULING_REQUEST_FOR_CONFIGURATION_DELAY = 5; @@ -50,12 +52,17 @@ public class SchedulerConfig extends CloudConfiguration { private final ConcurrentTaskScheduler taskScheduler; private final ScheduledTasks scheduledTask; + private final TaskScheduler cloudTaskScheduler; + private final CloudConfiguration cloudConfiguration; @Autowired public SchedulerConfig(@Qualifier("concurrentTaskScheduler") ConcurrentTaskScheduler concurrentTaskScheduler, - ScheduledTasks scheduledTask) { + ScheduledTasks scheduledTask, ThreadPoolTaskScheduler cloudTaskScheduler, + CloudConfiguration cloudConfiguration) { this.taskScheduler = concurrentTaskScheduler; this.scheduledTask = scheduledTask; + this.cloudTaskScheduler = cloudTaskScheduler; + this.cloudConfiguration = cloudConfiguration; } /** @@ -83,7 +90,7 @@ public class SchedulerConfig extends CloudConfiguration { public synchronized boolean tryToStartTask() { if (scheduledPrhTaskFutureList.isEmpty()) { scheduledPrhTaskFutureList.add(cloudTaskScheduler - .scheduleAtFixedRate(super::runTask, Instant.now(), + .scheduleAtFixedRate(cloudConfiguration::runTask, Instant.now(), Duration.ofMinutes(SCHEDULING_REQUEST_FOR_CONFIGURATION_DELAY))); scheduledPrhTaskFutureList.add(taskScheduler .scheduleWithFixedDelay(scheduledTask::scheduleMainPrhEventTask, |