rev:修改
This commit is contained in:
@@ -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()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user