mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-13 04:57:28 +00:00
[improvement][headless]Setup thread pool for data event listeners.
This commit is contained in:
@@ -11,6 +11,14 @@ import java.util.concurrent.TimeUnit;
|
||||
@Component
|
||||
public class ThreadPoolConfig {
|
||||
|
||||
@Bean("eventExecutor")
|
||||
public ThreadPoolExecutor getTaskEventExecutor() {
|
||||
return new ThreadPoolExecutor(4, 8, 60 * 3, TimeUnit.SECONDS,
|
||||
new LinkedBlockingQueue<>(1024),
|
||||
new ThreadFactoryBuilder().setNameFormat("supersonic-event-pool-").build(),
|
||||
new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
}
|
||||
|
||||
@Bean("commonExecutor")
|
||||
public ThreadPoolExecutor getCommonExecutor() {
|
||||
return new ThreadPoolExecutor(8, 16, 60 * 3, TimeUnit.SECONDS,
|
||||
|
||||
Reference in New Issue
Block a user