Created
November 30, 2019 12:37
-
-
Save albertoaflores/121704e41d6becf94b25ce7d01ea797a to your computer and use it in GitHub Desktop.
Generates a TaskExecutor to control the threads used in a given @async
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean(name = "myThreadPoolTaskExecutor") | |
public TaskExecutor threadPoolTaskExecutor() { | |
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); | |
executor.setCorePoolSize(4); | |
executor.setMaxPoolSize(4); | |
executor.setThreadNamePrefix("executor"); | |
executor.initialize(); | |
return executor; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment