25 lines
735 B
Java
25 lines
735 B
Java
package com.caliverse.admin.scheduler.config;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
|
|
@Configuration
|
|
@Slf4j
|
|
public class ScheduleSystemConfig {
|
|
@Bean
|
|
public ScheduledExecutorService scheduledExecutorService() {
|
|
return Executors.newScheduledThreadPool(
|
|
Runtime.getRuntime().availableProcessors(),
|
|
r -> {
|
|
Thread thread = new Thread(r, "scheduler-");
|
|
thread.setDaemon(true);
|
|
return thread;
|
|
}
|
|
);
|
|
}
|
|
}
|