|
|
@ -178,8 +178,14 @@ public final class DynamicThreadPoolPostProcessor implements BeanPostProcessor {
|
|
|
|
private void threadPoolParamReplace(ThreadPoolExecutor executor, ThreadPoolParameterInfo threadPoolParameterInfo) {
|
|
|
|
private void threadPoolParamReplace(ThreadPoolExecutor executor, ThreadPoolParameterInfo threadPoolParameterInfo) {
|
|
|
|
BlockingQueue workQueue = BlockingQueueTypeEnum.createBlockingQueue(threadPoolParameterInfo.getQueueType(), threadPoolParameterInfo.getCapacity());
|
|
|
|
BlockingQueue workQueue = BlockingQueueTypeEnum.createBlockingQueue(threadPoolParameterInfo.getQueueType(), threadPoolParameterInfo.getCapacity());
|
|
|
|
ReflectUtil.setFieldValue(executor, "workQueue", workQueue);
|
|
|
|
ReflectUtil.setFieldValue(executor, "workQueue", workQueue);
|
|
|
|
executor.setCorePoolSize(threadPoolParameterInfo.corePoolSizeAdapt());
|
|
|
|
// fix https://github.com/opengoofy/hippo4j/issues/1063
|
|
|
|
executor.setMaximumPoolSize(threadPoolParameterInfo.maximumPoolSizeAdapt());
|
|
|
|
if (threadPoolParameterInfo.getCorePoolSize() > executor.getMaximumPoolSize()) {
|
|
|
|
|
|
|
|
executor.setMaximumPoolSize(threadPoolParameterInfo.maximumPoolSizeAdapt());
|
|
|
|
|
|
|
|
executor.setCorePoolSize(threadPoolParameterInfo.corePoolSizeAdapt());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
executor.setCorePoolSize(threadPoolParameterInfo.corePoolSizeAdapt());
|
|
|
|
|
|
|
|
executor.setMaximumPoolSize(threadPoolParameterInfo.maximumPoolSizeAdapt());
|
|
|
|
|
|
|
|
}
|
|
|
|
executor.setKeepAliveTime(threadPoolParameterInfo.getKeepAliveTime(), TimeUnit.SECONDS);
|
|
|
|
executor.setKeepAliveTime(threadPoolParameterInfo.getKeepAliveTime(), TimeUnit.SECONDS);
|
|
|
|
executor.allowCoreThreadTimeOut(EnableEnum.getBool(threadPoolParameterInfo.getAllowCoreThreadTimeOut()));
|
|
|
|
executor.allowCoreThreadTimeOut(EnableEnum.getBool(threadPoolParameterInfo.getAllowCoreThreadTimeOut()));
|
|
|
|
executor.setRejectedExecutionHandler(RejectedPolicyTypeEnum.createPolicy(threadPoolParameterInfo.getRejectedType()));
|
|
|
|
executor.setRejectedExecutionHandler(RejectedPolicyTypeEnum.createPolicy(threadPoolParameterInfo.getRejectedType()));
|
|
|
|