stub: Shutdown ThreadlessExecutor only if onClose() is called (#9041)

It is only safe to shutdown the executor if onClose() is called. Normal
RPC completions (both success and failure) will see the future complete,
so this only avoids shutting down in stranger cases like an interceptor
throwing an exception.
This commit is contained in:
Eric Anderson 2022-04-01 08:49:34 -07:00 committed by GitHub
parent 71d38f5cae
commit 574fbb4327
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -161,6 +161,7 @@ public final class ClientCalls {
// Now wait for onClose() to be called, so interceptors can clean up
}
}
executor.shutdown();
return getUnchecked(responseFuture);
} catch (RuntimeException e) {
// Something very bad happened. All bets are off; it may be dangerous to wait for onClose().
@ -169,7 +170,6 @@ public final class ClientCalls {
// Something very bad happened. All bets are off; it may be dangerous to wait for onClose().
throw cancelThrow(call, e);
} finally {
executor.shutdown();
if (interrupt) {
Thread.currentThread().interrupt();
}