HTTPCLIENT-1958: PoolingHttpClientConnectionManager to throw ExecutionException in case of a lease operation cancellation instead of InterruptedException
(fixed previous commit)
This commit is contained in:
parent
50e7dd51e0
commit
7824d98d0c
|
@ -28,6 +28,7 @@ package org.apache.hc.client5.http.impl.io;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.CancellationException;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
@ -272,7 +273,7 @@ public class PoolingHttpClientConnectionManager
|
||||||
try {
|
try {
|
||||||
poolEntry = leaseFuture.get(timeout.getDuration(), timeout.getTimeUnit());
|
poolEntry = leaseFuture.get(timeout.getDuration(), timeout.getTimeUnit());
|
||||||
if (poolEntry == null || leaseFuture.isCancelled()) {
|
if (poolEntry == null || leaseFuture.isCancelled()) {
|
||||||
throw new InterruptedException();
|
throw new ExecutionException(new CancellationException("Operation cancelled"));
|
||||||
}
|
}
|
||||||
} catch (final TimeoutException ex) {
|
} catch (final TimeoutException ex) {
|
||||||
leaseFuture.cancel(true);
|
leaseFuture.cancel(true);
|
||||||
|
|
Loading…
Reference in New Issue