mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-07 23:51:17 +08:00
24 lines
730 B
Java
24 lines
730 B
Java
package com.openisle.config;
|
|
|
|
import java.util.concurrent.Executor;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
|
@Configuration
|
|
@EnableAsync
|
|
public class AsyncConfig {
|
|
|
|
@Bean(name = "notificationExecutor")
|
|
public Executor notificationExecutor() {
|
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
|
executor.setCorePoolSize(2);
|
|
executor.setMaxPoolSize(10);
|
|
executor.setQueueCapacity(100);
|
|
executor.setThreadNamePrefix("notification-");
|
|
executor.initialize();
|
|
return executor;
|
|
}
|
|
}
|