This is an automated email from the ASF dual-hosted git repository.
zhangzicheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 8cbe3344a [type: refactor] Fix thread pool (#3909)
8cbe3344a is described below
commit 8cbe3344ae7b1b63e712085e0faf0c08637df386
Author: qinghai777 <[email protected]>
AuthorDate: Fri Sep 2 18:26:19 2022 +0800
[type: refactor] Fix thread pool (#3909)
* fix threadpool
---
.../shenyu/plugin/logging/common/collector/AbstractLogCollector.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/collector/AbstractLogCollector.java
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/collector/AbstractLogCollector.java
index 9cbc84126..f43433707 100644
---
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/collector/AbstractLogCollector.java
+++
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/collector/AbstractLogCollector.java
@@ -22,6 +22,7 @@ import
org.apache.shenyu.common.concurrent.ShenyuThreadFactory;
import org.apache.shenyu.common.concurrent.ShenyuThreadPoolExecutor;
import org.apache.shenyu.common.config.ShenyuConfig;
import org.apache.shenyu.common.constant.Constants;
+import org.apache.shenyu.common.utils.Singleton;
import org.apache.shenyu.common.utils.ThreadUtils;
import org.apache.shenyu.plugin.logging.common.client.LogConsumeClient;
import org.apache.shenyu.plugin.logging.common.entity.ShenyuRequestLog;
@@ -32,6 +33,7 @@ import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
+import java.util.Optional;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
@@ -53,12 +55,11 @@ public abstract class AbstractLogCollector implements
LogCollector {
private final AtomicBoolean started = new AtomicBoolean(true);
- private final ShenyuConfig config = new ShenyuConfig();
-
@Override
public void start() {
bufferSize =
LogCollectConfigUtils.getGenericGlobalConfig().getBufferQueueSize();
bufferQueue = new LinkedBlockingDeque<>(bufferSize);
+ ShenyuConfig config =
Optional.ofNullable(Singleton.INST.get(ShenyuConfig.class)).orElse(new
ShenyuConfig());
final ShenyuConfig.SharedPool sharedPool = config.getSharedPool();
ShenyuThreadPoolExecutor threadExecutor = new
ShenyuThreadPoolExecutor(sharedPool.getCorePoolSize(),
sharedPool.getMaximumPoolSize(),
sharedPool.getKeepAliveTime(), TimeUnit.MILLISECONDS,