hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asan...@apache.org
Subject svn commit: r1620956 - in /httpcomponents/httpcore/trunk/httpcore-nio/src: main/java/org/apache/http/nio/pool/RouteSpecificPool.java test/java/org/apache/http/nio/pool/TestNIOConnPool.java test/java/org/apache/http/nio/pool/TestRouteSpecificPool.java
Date Wed, 27 Aug 2014 18:57:15 GMT
Author: asankha
Date: Wed Aug 27 18:57:15 2014
New Revision: 1620956

URL: http://svn.apache.org/r1620956
Log:
make a connection exception throw a ConnectException instead of a SocketTimeoutException to
allow a FutureCallback handler to correctly distinguish between the two events


Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestRouteSpecificPool.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java?rev=1620956&r1=1620955&r2=1620956&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
Wed Aug 27 18:57:15 2014
@@ -26,7 +26,7 @@
  */
 package org.apache.http.nio.pool;
 
-import java.net.SocketTimeoutException;
+import java.net.ConnectException;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -167,7 +167,7 @@ abstract class RouteSpecificPool<T, C, E
 
     public void timeout(final SessionRequest request) {
         final BasicFuture<E> future = removeRequest(request);
-        future.failed(new SocketTimeoutException());
+        future.failed(new ConnectException());
     }
 
     public void shutdown() {

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java?rev=1620956&r1=1620955&r2=1620956&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestNIOConnPool.java
Wed Aug 27 18:57:15 2014
@@ -29,7 +29,7 @@ package org.apache.http.nio.pool;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
-import java.net.SocketTimeoutException;
+import java.net.ConnectException;
 import java.net.UnknownHostException;
 import java.util.Collections;
 import java.util.concurrent.ExecutionException;
@@ -296,7 +296,7 @@ public class TestNIOConnPool {
             future.get();
             Assert.fail("ExecutionException should have been thrown");
         } catch (final ExecutionException ex) {
-            Assert.assertTrue(ex.getCause() instanceof SocketTimeoutException);
+            Assert.assertTrue(ex.getCause() instanceof ConnectException);
         }
 
         totals = pool.getTotalStats();

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestRouteSpecificPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestRouteSpecificPool.java?rev=1620956&r1=1620955&r2=1620956&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestRouteSpecificPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/pool/TestRouteSpecificPool.java
Wed Aug 27 18:57:15 2014
@@ -27,7 +27,7 @@
 package org.apache.http.nio.pool;
 
 import java.io.IOException;
-import java.net.SocketTimeoutException;
+import java.net.ConnectException;
 import java.util.concurrent.ExecutionException;
 
 import org.apache.http.concurrent.BasicFuture;
@@ -171,7 +171,7 @@ public class TestRouteSpecificPool {
             future.get();
             Assert.fail("ExecutionException should have been thrown");
         } catch (final ExecutionException ex) {
-            Assert.assertTrue(ex.getCause() instanceof SocketTimeoutException);
+            Assert.assertTrue(ex.getCause() instanceof ConnectException);
         }
         Assert.assertEquals(0, pool.getAllocatedCount());
         Assert.assertEquals(0, pool.getAvailableCount());



Mime
View raw message