Commit 4cd338e9 authored by ipatini's avatar ipatini
Browse files

EMS: Control Service: Added 'ControlServiceProperties.TaskSchedulerProperties'...

EMS: Control Service: Added 'ControlServiceProperties.TaskSchedulerProperties' inner class, and moved TaskSchedulerConfig settings into it.
parent 9c5f9878
......@@ -74,4 +74,12 @@ public class ControlServiceProperties {
// control.ssl.** settings
private KeystoreAndCertificateProperties ssl;
private TaskSchedulerProperties taskScheduler = new TaskSchedulerProperties();
@Data
public static class TaskSchedulerProperties {
@Min(1)
private int threadPoolSize = 2;
}
}
......@@ -9,25 +9,24 @@
package eu.melodic.event.control.util;
import eu.melodic.event.control.properties.ControlServiceProperties;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import javax.validation.constraints.Min;
@Slf4j
@Configuration
@EnableScheduling
@RequiredArgsConstructor
public class TaskSchedulerConfig {
@Value("${control.task-scheduler.thread-pool-size:2}")
@Min(1)
private int threadPoolSize;
private final ControlServiceProperties properties;
@Bean
public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
int threadPoolSize = properties.getTaskScheduler().getThreadPoolSize();
log.info("TaskSchedulerConfig: TaskScheduler thread pool size: {}", threadPoolSize);
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
threadPoolTaskScheduler.setPoolSize(threadPoolSize);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment