Cancel connection request on exception

This commit is contained in:
Bryan Keller 2022-11-14 07:54:48 -08:00 committed by Oleg Kalnichevski
parent 290ec22022
commit 9cde791f35
1 changed files with 3 additions and 0 deletions

View File

@ -116,11 +116,14 @@ class InternalExecRuntime implements ExecRuntime, Cancellable {
log.debug("{} acquired endpoint {}", id, ConnPoolSupport.getId(connectionEndpoint));
}
} catch(final TimeoutException ex) {
connRequest.cancel();
throw new ConnectionRequestTimeoutException(ex.getMessage());
} catch(final InterruptedException interrupted) {
connRequest.cancel();
Thread.currentThread().interrupt();
throw new RequestFailedException("Request aborted", interrupted);
} catch(final ExecutionException ex) {
connRequest.cancel();
Throwable cause = ex.getCause();
if (cause == null) {
cause = ex;