rev:修改

This commit is contained in:
2025-12-04 16:35:49 +08:00
parent 9f5b25e687
commit adbb171a73

View File

@@ -16,9 +16,12 @@
package org.nl.config.thread;
import org.dromara.dynamictp.core.support.DynamicTp;
import org.nl.config.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@@ -32,14 +35,19 @@ import java.util.concurrent.TimeUnit;
@Configuration
public class ThreadPoolExecutorUtil {
@Bean(name = "meshandlerPool")
public ThreadPoolExecutor meshandlerPool(){
@Autowired
private AsyncTaskProperties asyncTaskProperties;
@Bean
@Primary
@DynamicTp("el-thread")
public ThreadPoolExecutor threadPoolExecutor() {
return new ThreadPoolExecutor(
4,
16,
30,
asyncTaskProperties.getCorePoolSize(),
asyncTaskProperties.getMaxPoolSize(),
asyncTaskProperties.getKeepAliveSeconds(),
TimeUnit.SECONDS,
new ArrayBlockingQueue<>(64),
new ArrayBlockingQueue<>(asyncTaskProperties.getQueueCapacity()),
new TheadFactoryName()
);
}