fixed task scheduler config
This commit is contained in:
parent
8cab729401
commit
2c197665f0
1 changed files with 10 additions and 0 deletions
|
@ -17,6 +17,7 @@ import org.springframework.scheduling.annotation.AsyncConfigurer;
|
||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableAsync
|
@EnableAsync
|
||||||
|
@ -74,6 +75,15 @@ public class AsyncServiceSpringConfig implements AsyncConfigurer {
|
||||||
return executor;
|
return executor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
|
||||||
|
final ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
|
||||||
|
threadPoolTaskScheduler.setPoolSize(5);
|
||||||
|
threadPoolTaskScheduler.setWaitForTasksToCompleteOnShutdown(false);
|
||||||
|
threadPoolTaskScheduler.setThreadNamePrefix("SEB-Server-BgTask-");
|
||||||
|
return threadPoolTaskScheduler;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Executor getAsyncExecutor() {
|
public Executor getAsyncExecutor() {
|
||||||
return threadPoolTaskExecutor();
|
return threadPoolTaskExecutor();
|
||||||
|
|
Loading…
Reference in a new issue