Merge branch 'HTTPCLIENT-1958' into 4.5.x
This commit is contained in:
commit
024f692df3
|
@ -30,6 +30,7 @@ import java.io.Closeable;
|
|||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
@ -302,7 +303,7 @@ public class PoolingHttpClientConnectionManager
|
|||
try {
|
||||
entry = future.get(timeout, timeUnit);
|
||||
if (entry == null || future.isCancelled()) {
|
||||
throw new InterruptedException();
|
||||
throw new ExecutionException(new CancellationException("Operation cancelled"));
|
||||
}
|
||||
Asserts.check(entry.getConnection() != null, "Pool entry with no connection");
|
||||
if (this.log.isDebugEnabled()) {
|
||||
|
|
|
@ -30,6 +30,7 @@ package org.apache.http.impl.conn;
|
|||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
@ -147,7 +148,7 @@ public class TestPoolingHttpClientConnectionManager {
|
|||
Mockito.verify(pool).release(entry, false);
|
||||
}
|
||||
|
||||
@Test(expected=InterruptedException.class)
|
||||
@Test(expected= ExecutionException.class)
|
||||
public void testLeaseFutureCancelled() throws Exception {
|
||||
final HttpHost target = new HttpHost("localhost", 80);
|
||||
final HttpRoute route = new HttpRoute(target);
|
||||
|
|
Loading…
Reference in New Issue