Skip to content

Commit

Permalink
fix 1129: AbstractHystrixThreadPoolAdapter set BlockingQueueCapacity
Browse files Browse the repository at this point in the history
  • Loading branch information
jjiey committed Mar 20, 2023
1 parent 771d73f commit 168252f
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -67,9 +68,11 @@ public ThreadPoolAdapterState getThreadPoolState(String identify) {
ThreadPoolAdapterState result = new ThreadPoolAdapterState();
ThreadPoolExecutor threadPoolExecutor = hystrixConsumeExecutor.get(identify);
if (threadPoolExecutor != null) {
BlockingQueue<Runnable> 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);
Expand Down

0 comments on commit 168252f

Please sign in to comment.