From 6df52eb796e42f38ccb68cefd42cfc0e0c41f092 Mon Sep 17 00:00:00 2001 From: yangsanity Date: Mon, 20 Mar 2023 13:07:31 +0800 Subject: [PATCH] fix 1129: AbstractHystrixThreadPoolAdapter set BlockingQueueCapacity (#1130) --- .../adapter/hystrix/AbstractHystrixThreadPoolAdapter.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hippo4j-adapter/hippo4j-adapter-hystrix/src/main/java/cn/hippo4j/adapter/hystrix/AbstractHystrixThreadPoolAdapter.java b/hippo4j-adapter/hippo4j-adapter-hystrix/src/main/java/cn/hippo4j/adapter/hystrix/AbstractHystrixThreadPoolAdapter.java index fb6ad924..441a1efb 100644 --- a/hippo4j-adapter/hippo4j-adapter-hystrix/src/main/java/cn/hippo4j/adapter/hystrix/AbstractHystrixThreadPoolAdapter.java +++ b/hippo4j-adapter/hippo4j-adapter-hystrix/src/main/java/cn/hippo4j/adapter/hystrix/AbstractHystrixThreadPoolAdapter.java @@ -32,6 +32,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.BlockingQueue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadPoolExecutor; @@ -67,9 +68,11 @@ public abstract class AbstractHystrixThreadPoolAdapter implements ThreadPoolAdap ThreadPoolAdapterState result = new ThreadPoolAdapterState(); ThreadPoolExecutor threadPoolExecutor = hystrixConsumeExecutor.get(identify); if (threadPoolExecutor != null) { + BlockingQueue blockingQueue = threadPoolExecutor.getQueue(); result.setThreadPoolKey(identify); result.setCoreSize(threadPoolExecutor.getCorePoolSize()); result.setMaximumSize(threadPoolExecutor.getMaximumPoolSize()); + result.setBlockingQueueCapacity(blockingQueue.size() + blockingQueue.remainingCapacity()); return result; } log.warn("[{}] Hystrix thread pool not found.", identify);