25 lines
781 B
Java
25 lines
781 B
Java
package ru.soune.nocopy.configuration.file;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
|
import java.util.concurrent.Executor;
|
|
|
|
@Configuration
|
|
@EnableAsync
|
|
public class AsyncConfig {
|
|
|
|
@Bean(name = "fileUploadTaskExecutor")
|
|
public Executor fileUploadTaskExecutor() {
|
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
|
executor.setCorePoolSize(3);
|
|
executor.setMaxPoolSize(10);
|
|
executor.setQueueCapacity(50);
|
|
executor.setThreadNamePrefix("FileUpload-");
|
|
executor.initialize();
|
|
return executor;
|
|
}
|
|
}
|