Skip to content

Commit 168252f

Browse files
fix 1129: AbstractHystrixThreadPoolAdapter set BlockingQueueCapacity
1 parent 771d73f commit 168252f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

hippo4j-adapter/hippo4j-adapter-hystrix/src/main/java/cn/hippo4j/adapter/hystrix/AbstractHystrixThreadPoolAdapter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.util.HashMap;
3333
import java.util.List;
3434
import java.util.Map;
35+
import java.util.concurrent.BlockingQueue;
3536
import java.util.concurrent.ConcurrentHashMap;
3637
import java.util.concurrent.ScheduledExecutorService;
3738
import java.util.concurrent.ThreadPoolExecutor;
@@ -67,9 +68,11 @@ public ThreadPoolAdapterState getThreadPoolState(String identify) {
6768
ThreadPoolAdapterState result = new ThreadPoolAdapterState();
6869
ThreadPoolExecutor threadPoolExecutor = hystrixConsumeExecutor.get(identify);
6970
if (threadPoolExecutor != null) {
71+
BlockingQueue<Runnable> blockingQueue = threadPoolExecutor.getQueue();
7072
result.setThreadPoolKey(identify);
7173
result.setCoreSize(threadPoolExecutor.getCorePoolSize());
7274
result.setMaximumSize(threadPoolExecutor.getMaximumPoolSize());
75+
result.setBlockingQueueCapacity(blockingQueue.size() + blockingQueue.remainingCapacity());
7376
return result;
7477
}
7578
log.warn("[{}] Hystrix thread pool not found.", identify);

0 commit comments

Comments
 (0)