diff --git a/stub/src/main/java/io/grpc/stub/BlockingClientCall.java b/stub/src/main/java/io/grpc/stub/BlockingClientCall.java index 2c896c7208a..27bd42e53bb 100644 --- a/stub/src/main/java/io/grpc/stub/BlockingClientCall.java +++ b/stub/src/main/java/io/grpc/stub/BlockingClientCall.java @@ -273,7 +273,7 @@ public void halfClose() { */ @VisibleForTesting Status getClosedStatus() { - drainQuietly(); + executor.drain(); CloseState state = closeState.get(); return (state == null) ? null : state.status; } @@ -295,7 +295,7 @@ boolean isEitherReadOrWriteReady() { */ @VisibleForTesting boolean isReadReady() { - drainQuietly(); + executor.drain(); return !buffer.isEmpty(); } @@ -308,7 +308,7 @@ boolean isReadReady() { */ @VisibleForTesting boolean isWriteReady() { - drainQuietly(); + executor.drain(); return isWriteLegal() && call.isReady(); } @@ -325,14 +325,6 @@ ClientCall.Listener getListener() { return new QueuingListener(); } - private void drainQuietly() { - try { - executor.drain(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - } - private final class QueuingListener extends ClientCall.Listener { @Override public void onMessage(RespT value) { diff --git a/stub/src/main/java/io/grpc/stub/ClientCalls.java b/stub/src/main/java/io/grpc/stub/ClientCalls.java index 8cd31ea9cca..ff2804a0a1f 100644 --- a/stub/src/main/java/io/grpc/stub/ClientCalls.java +++ b/stub/src/main/java/io/grpc/stub/ClientCalls.java @@ -935,11 +935,8 @@ public void waitAndDrainWithTimeout(boolean waitForever, long end, } } - /** - * Executes all queued Runnables and if there were any wakes up any waiting threads. - */ - public void drain() throws InterruptedException { - throwIfInterrupted(); + /** Executes all queued Runnables and if there were any wakes up any waiting threads. */ + void drain() { Runnable runnable; boolean didWork = false;