You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2019/01/08 11:04:43 UTC

[httpcomponents-client] branch HTTPCLIENT-1958 created (now 9e56195)

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a change to branch HTTPCLIENT-1958
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git.


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

This branch includes the following new commits:

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

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[httpcomponents-client] 01/01: HTTPCLIENT-1958: PoolingHttpClientConnectionManager to throw ExecutionException in case of a lease operation cancellation instead of InterruptedException

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch HTTPCLIENT-1958
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git

commit 9e561957d7d098453cf04fe140f6726539281814
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Tue Jan 8 12:04:17 2019 +0100

    HTTPCLIENT-1958: PoolingHttpClientConnectionManager to throw ExecutionException in case of a lease operation cancellation instead of InterruptedException
---
 .../org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java  | 3 ++-
 .../apache/http/impl/conn/TestPoolingHttpClientConnectionManager.java  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java b/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
index 4c38bd8..af97d8a 100644
--- a/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
+++ b/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
@@ -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()) {
diff --git a/httpclient/src/test/java/org/apache/http/impl/conn/TestPoolingHttpClientConnectionManager.java b/httpclient/src/test/java/org/apache/http/impl/conn/TestPoolingHttpClientConnectionManager.java
index 5b379d3..51bc2ef 100644
--- a/httpclient/src/test/java/org/apache/http/impl/conn/TestPoolingHttpClientConnectionManager.java
+++ b/httpclient/src/test/java/org/apache/http/impl/conn/TestPoolingHttpClientConnectionManager.java
@@ -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);