From 168252f95cdfc3f3b18126a211df8acc371a2aaf Mon Sep 17 00:00:00 2001 From: yangsanity Date: Mon, 20 Mar 2023 13:01:31 +0800 Subject: [PATCH] fix 1129: AbstractHystrixThreadPoolAdapter set BlockingQueueCapacity --- .../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 fb6ad924c7..441a1efb1c 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.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 ThreadPoolAdapterState getThreadPoolState(String identify) { 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);