Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions stub/src/main/java/io/grpc/stub/BlockingClientCall.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public void halfClose() {
*/
@VisibleForTesting
Status getClosedStatus() {
drainQuietly();
executor.drain();
CloseState state = closeState.get();
return (state == null) ? null : state.status;
}
Expand All @@ -295,7 +295,7 @@ boolean isEitherReadOrWriteReady() {
*/
@VisibleForTesting
boolean isReadReady() {
drainQuietly();
executor.drain();

return !buffer.isEmpty();
}
Expand All @@ -308,7 +308,7 @@ boolean isReadReady() {
*/
@VisibleForTesting
boolean isWriteReady() {
drainQuietly();
executor.drain();

return isWriteLegal() && call.isReady();
}
Expand All @@ -325,14 +325,6 @@ ClientCall.Listener<RespT> getListener() {
return new QueuingListener();
}

private void drainQuietly() {
try {
executor.drain();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}

private final class QueuingListener extends ClientCall.Listener<RespT> {
@Override
public void onMessage(RespT value) {
Expand Down
7 changes: 2 additions & 5 deletions stub/src/main/java/io/grpc/stub/ClientCalls.java
Original file line number Diff line number Diff line change
Expand Up @@ -935,11 +935,8 @@ public <T> 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;

Expand Down