In blocking stubs, throw Status.CANCELLED on interruption

This was already being done in one case, but should have been done for
the other occurrances of InterruptedException. Before the
RuntimeException is just asking to be a bug since application code will
commonly only catch StatusRuntimeException.
This commit is contained in:
Eric Anderson 2016-02-13 17:27:13 -08:00
parent 2d2398ce3a
commit 898634f96a
1 changed files with 2 additions and 2 deletions

View File

@ -135,7 +135,7 @@ public class ClientCalls {
executor.waitAndDrain();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException(e);
throw Status.CANCELLED.withCause(e).asRuntimeException();
}
}
return getUnchecked(responseFuture);
@ -436,7 +436,7 @@ public class ClientCalls {
last = waitForNext();
} catch (InterruptedException ie) {
Thread.interrupted();
throw new RuntimeException(ie);
throw Status.CANCELLED.withCause(ie).asRuntimeException();
}
}
if (last instanceof Status) {