From 4f0cf03bed4180e4e277a99e1194cc17b0d198d4 Mon Sep 17 00:00:00 2001 From: Kiran + Kenji Date: Mon, 13 Apr 2015 15:51:36 -0700 Subject: [PATCH] Expose running and queued call counts for monitoring --- okhttp/src/main/java/com/squareup/okhttp/Dispatcher.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/okhttp/src/main/java/com/squareup/okhttp/Dispatcher.java b/okhttp/src/main/java/com/squareup/okhttp/Dispatcher.java index a696c0ca7..a9346701f 100644 --- a/okhttp/src/main/java/com/squareup/okhttp/Dispatcher.java +++ b/okhttp/src/main/java/com/squareup/okhttp/Dispatcher.java @@ -177,4 +177,12 @@ public final class Dispatcher { synchronized void finished(Call call) { if (!executedCalls.remove(call)) throw new AssertionError("Call wasn't in-flight!"); } + + public synchronized int getRunningCallCount() { + return runningCalls.size(); + } + + public synchronized int getQueuedCallCount() { + return readyCalls.size(); + } }