hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1509557 - in /httpcomponents/httpasyncclient/trunk/httpasyncclient/src: main/java/org/apache/http/impl/nio/client/ main/java/org/apache/http/impl/nio/conn/ main/java/org/apache/http/nio/conn/ test/java/org/apache/http/impl/nio/conn/
Date Fri, 02 Aug 2013 06:40:48 GMT
Author: olegk
Date: Fri Aug  2 06:40:47 2013
New Revision: 1509557

URL: http://svn.apache.org/r1509557
Log:
HTTPCORE-340: Support for lease timeout distinct from connect timeout

Modified:
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalClientExchangeHandlerImpl.java
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/PoolingNHttpClientConnectionManager.java
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/NHttpClientConnectionManager.java
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/impl/nio/conn/TestPoolingHttpClientAsyncConnectionManager.java

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java?rev=1509557&r1=1509556&r2=1509557&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java
(original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java
Fri Aug  2 06:40:47 2013
@@ -326,7 +326,9 @@ class DefaultClientExchangeHandlerImpl<T
         this.connmgr.requestConnection(
                 route,
                 userToken,
-                config.getConnectionRequestTimeout(), TimeUnit.MILLISECONDS,
+                config.getConnectTimeout(),
+                config.getConnectionRequestTimeout(),
+                TimeUnit.MILLISECONDS,
                 new FutureCallback<NHttpClientConnection>() {
 
                     public void completed(final NHttpClientConnection managedConn) {

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalClientExchangeHandlerImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalClientExchangeHandlerImpl.java?rev=1509557&r1=1509556&r2=1509557&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalClientExchangeHandlerImpl.java
(original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalClientExchangeHandlerImpl.java
Fri Aug  2 06:40:47 2013
@@ -347,7 +347,9 @@ public class MinimalClientExchangeHandle
         this.connmgr.requestConnection(
                 this.route,
                 userToken,
-                config.getConnectionRequestTimeout(), TimeUnit.MILLISECONDS,
+                config.getConnectTimeout(),
+                config.getConnectionRequestTimeout(),
+                TimeUnit.MILLISECONDS,
                 new FutureCallback<NHttpClientConnection>() {
 
                     public void completed(final NHttpClientConnection managedConn) {

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/PoolingNHttpClientConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/PoolingNHttpClientConnectionManager.java?rev=1509557&r1=1509556&r2=1509557&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/PoolingNHttpClientConnectionManager.java
(original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/PoolingNHttpClientConnectionManager.java
Fri Aug  2 06:40:47 2013
@@ -217,6 +217,7 @@ public class PoolingNHttpClientConnectio
             final HttpRoute route,
             final Object state,
             final long connectTimeout,
+            final long leaseTimeout,
             final TimeUnit tunit,
             final FutureCallback<NHttpClientConnection> callback) {
         Args.notNull(route, "HTTP route");
@@ -237,8 +238,8 @@ public class PoolingNHttpClientConnectio
                     " protocol is not supported"));
             return future;
         }
-        this.pool.lease(route, state, connectTimeout,
-                tunit != null ? tunit : TimeUnit.MILLISECONDS,
+        this.pool.lease(route, state,
+                connectTimeout, leaseTimeout, tunit != null ? tunit : TimeUnit.MILLISECONDS,
                 new InternalPoolEntryCallback(future));
         return future;
     }

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/NHttpClientConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/NHttpClientConnectionManager.java?rev=1509557&r1=1509556&r2=1509557&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/NHttpClientConnectionManager.java
(original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/NHttpClientConnectionManager.java
Fri Aug  2 06:40:47 2013
@@ -55,7 +55,7 @@ public interface NHttpClientConnectionMa
      */
     Future<NHttpClientConnection> requestConnection(
             HttpRoute route, Object state,
-            long connectTimeout, TimeUnit timeUnit,
+            long connectTimeout, long leaseTimeout, TimeUnit timeUnit,
             FutureCallback<NHttpClientConnection> callback);
 
     /**

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/impl/nio/conn/TestPoolingHttpClientAsyncConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/impl/nio/conn/TestPoolingHttpClientAsyncConnectionManager.java?rev=1509557&r1=1509556&r2=1509557&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/impl/nio/conn/TestPoolingHttpClientAsyncConnectionManager.java
(original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/impl/nio/conn/TestPoolingHttpClientAsyncConnectionManager.java
Fri Aug  2 06:40:47 2013
@@ -128,13 +128,14 @@ public class TestPoolingHttpClientAsyncC
         final HttpHost target = new HttpHost("localhost");
         final HttpRoute route = new HttpRoute(target);
         final Future<NHttpClientConnection> future = connman.requestConnection(
-            route, "some state", 1000L, TimeUnit.MILLISECONDS, connCallback);
+            route, "some state", 1000L, 2000L, TimeUnit.MILLISECONDS, connCallback);
         Assert.assertNotNull(future);
 
         Mockito.verify(pool).lease(
                 Mockito.same(route),
                 Mockito.eq("some state"),
                 Mockito.eq(1000L),
+                Mockito.eq(2000L),
                 Mockito.eq(TimeUnit.MILLISECONDS),
                 poolEntryCallbackCaptor.capture());
         final FutureCallback<CPoolEntry> callaback = poolEntryCallbackCaptor.getValue();
@@ -164,13 +165,14 @@ public class TestPoolingHttpClientAsyncC
         final HttpHost target = new HttpHost("localhost");
         final HttpRoute route = new HttpRoute(target);
         final Future<NHttpClientConnection> future = connman.requestConnection(
-            route, "some state", 1000L, TimeUnit.MILLISECONDS, connCallback);
+            route, "some state", 1000L, 2000L, TimeUnit.MILLISECONDS, connCallback);
         Assert.assertNotNull(future);
 
         Mockito.verify(pool).lease(
                 Mockito.same(route),
                 Mockito.eq("some state"),
                 Mockito.eq(1000L),
+                Mockito.eq(2000L),
                 Mockito.eq(TimeUnit.MILLISECONDS),
                 poolEntryCallbackCaptor.capture());
         final FutureCallback<CPoolEntry> callaback = poolEntryCallbackCaptor.getValue();
@@ -194,7 +196,7 @@ public class TestPoolingHttpClientAsyncC
         final HttpHost target = new HttpHost("localhost");
         final HttpRoute route = new HttpRoute(target);
         final Future<NHttpClientConnection> future = connman.requestConnection(
-            route, "some state", 1000L, TimeUnit.MILLISECONDS, null);
+            route, "some state", 1000L, 2000L, TimeUnit.MILLISECONDS, null);
         Assert.assertNotNull(future);
         future.cancel(true);
 
@@ -202,6 +204,7 @@ public class TestPoolingHttpClientAsyncC
                 Mockito.same(route),
                 Mockito.eq("some state"),
                 Mockito.eq(1000L),
+                Mockito.eq(2000L),
                 Mockito.eq(TimeUnit.MILLISECONDS),
                 poolEntryCallbackCaptor.capture());
         final FutureCallback<CPoolEntry> callaback = poolEntryCallbackCaptor.getValue();
@@ -218,13 +221,14 @@ public class TestPoolingHttpClientAsyncC
         final HttpHost target = new HttpHost("localhost");
         final HttpRoute route = new HttpRoute(target);
         final Future<NHttpClientConnection> future = connman.requestConnection(
-            route, "some state", 1000L, TimeUnit.MILLISECONDS, null);
+            route, "some state", 1000L, 2000L, TimeUnit.MILLISECONDS, null);
         Assert.assertNotNull(future);
 
         Mockito.verify(pool).lease(
                 Mockito.same(route),
                 Mockito.eq("some state"),
                 Mockito.eq(1000L),
+                Mockito.eq(2000L),
                 Mockito.eq(TimeUnit.MILLISECONDS),
                 poolEntryCallbackCaptor.capture());
         final FutureCallback<CPoolEntry> callaback = poolEntryCallbackCaptor.getValue();
@@ -239,13 +243,14 @@ public class TestPoolingHttpClientAsyncC
         final HttpHost target = new HttpHost("localhost");
         final HttpRoute route = new HttpRoute(target);
         final Future<NHttpClientConnection> future = connman.requestConnection(
-            route, "some state", 1000L, TimeUnit.MILLISECONDS, null);
+            route, "some state", 1000L, 2000L, TimeUnit.MILLISECONDS, null);
         Assert.assertNotNull(future);
 
         Mockito.verify(pool).lease(
                 Mockito.same(route),
                 Mockito.eq("some state"),
                 Mockito.eq(1000L),
+                Mockito.eq(2000L),
                 Mockito.eq(TimeUnit.MILLISECONDS),
                 poolEntryCallbackCaptor.capture());
         final FutureCallback<CPoolEntry> callaback = poolEntryCallbackCaptor.getValue();



Mime
View raw message