HTTPCLIENT-1958: PoolingHttpClientConnectionManager to throw ExecutionException in case of a lease operation cancellation instead of InterruptedException

(fixed previous commit)
This commit is contained in:
Oleg Kalnichevski 2019-01-08 12:04:17 +01:00
parent 50e7dd51e0
commit 7824d98d0c
1 changed files with 2 additions and 1 deletions

View File

@ -28,6 +28,7 @@ package org.apache.hc.client5.http.impl.io;
import java.io.IOException;
import java.util.Set;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeoutException;
@ -272,7 +273,7 @@ public class PoolingHttpClientConnectionManager
try {
poolEntry = leaseFuture.get(timeout.getDuration(), timeout.getTimeUnit());
if (poolEntry == null || leaseFuture.isCancelled()) {
throw new InterruptedException();
throw new ExecutionException(new CancellationException("Operation cancelled"));
}
} catch (final TimeoutException ex) {
leaseFuture.cancel(true);