mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
feat: optimize OmsLocalDbPool config
This commit is contained in:
parent
a32d7cebb5
commit
5acb8f82e7
@ -53,8 +53,9 @@ public class ThreadPoolConfig {
|
|||||||
@Bean(PJThreadPool.LOCAL_DB_POOL)
|
@Bean(PJThreadPool.LOCAL_DB_POOL)
|
||||||
public TaskExecutor initOmsLocalDbPool() {
|
public TaskExecutor initOmsLocalDbPool() {
|
||||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||||
executor.setCorePoolSize(Runtime.getRuntime().availableProcessors() / 2);
|
int tSize = Math.max(1, Runtime.getRuntime().availableProcessors() / 2);
|
||||||
executor.setMaxPoolSize(Runtime.getRuntime().availableProcessors() / 2);
|
executor.setCorePoolSize(tSize);
|
||||||
|
executor.setMaxPoolSize(tSize);
|
||||||
executor.setQueueCapacity(2048);
|
executor.setQueueCapacity(2048);
|
||||||
executor.setThreadNamePrefix("PJ-LOCALDB-");
|
executor.setThreadNamePrefix("PJ-LOCALDB-");
|
||||||
executor.setRejectedExecutionHandler(RejectedExecutionHandlerFactory.newAbort(PJThreadPool.LOCAL_DB_POOL));
|
executor.setRejectedExecutionHandler(RejectedExecutionHandlerFactory.newAbort(PJThreadPool.LOCAL_DB_POOL));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user