Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 3d3395dd authored by Darrel Danadyaksa Poli's avatar Darrel Danadyaksa Poli
Browse files

[GREEN] Add AsyncConfig for email task executor with configurable thread pool

parent 19724b02
No related branches found
No related tags found
No related merge requests found
package com.safetypin.authentication.config;
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 = "emailTaskExecutor")
public Executor taskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(2);
executor.setMaxPoolSize(5);
executor.setQueueCapacity(100);
executor.setThreadNamePrefix("EmailThread-");
executor.initialize();
return executor;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment