cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1369612 - in /cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient: AsyncHTTPConduit.java CXFAsyncRequester.java
Date Sun, 05 Aug 2012 15:34:26 GMT
Author: olegk
Date: Sun Aug  5 15:34:26 2012
New Revision: 1369612

URL: http://svn.apache.org/viewvc?rev=1369612&view=rev
Log:
Honor connection timeout specified in HTTPClientPolicy

Modified:
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFAsyncRequester.java

Modified: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java?rev=1369612&r1=1369611&r2=1369612&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
(original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
Sun Aug  5 15:34:26 2012
@@ -44,7 +44,6 @@ import org.apache.http.Header;
 import org.apache.http.HttpResponse;
 import org.apache.http.concurrent.FutureCallback;
 import org.apache.http.entity.BasicHttpEntity;
-import org.apache.http.nio.protocol.HttpAsyncResponseConsumer;
 import org.apache.http.nio.util.HeapByteBufferAllocator;
 import org.apache.http.protocol.BasicHttpContext;
 
@@ -177,9 +176,6 @@ public class AsyncHTTPConduit extends HT
                 
             };
             
-            HttpAsyncResponseConsumer<Boolean> consumer = new CXFHttpAsyncResponseConsumer(inbuf,

-                    responseCallback);
-            
             FutureCallback<Boolean> callback = new FutureCallback<Boolean>()
{
 
                 public void completed(Boolean result) {
@@ -203,13 +199,12 @@ public class AsyncHTTPConduit extends HT
             //FIXME - what to do for SSL/TLS?
             //tlsClientParameters.*
 
-            //FIXME - what to do with the connection timeout 
-            //long connectTimout = csPolicy.getConnectionTimeout();
-            
-            factory.getRequester().execute(new CXFHttpAsyncRequestProducer(entity, outbuf),
-                         consumer,
-                         new BasicHttpContext(),
-                         callback);
+            factory.getRequester().execute(
+                        csPolicy,
+                        new CXFHttpAsyncRequestProducer(entity, outbuf),
+                        new CXFHttpAsyncResponseConsumer(inbuf, responseCallback),
+                        new BasicHttpContext(),
+                        callback);
             
             wrappedStream = new OutputStream() {
                 public void write(byte b[], int off, int len) throws IOException {

Modified: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFAsyncRequester.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFAsyncRequester.java?rev=1369612&r1=1369611&r2=1369612&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFAsyncRequester.java
(original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/CXFAsyncRequester.java
Sun Aug  5 15:34:26 2012
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
 import org.apache.http.ConnectionClosedException;
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.HttpHost;
@@ -62,6 +63,7 @@ public class CXFAsyncRequester {
     }
 
     public <T> Future<T> execute(
+            final HTTPClientPolicy csPolicy,
             final HttpAsyncRequestProducer requestProducer,
             final HttpAsyncResponseConsumer<T> responseConsumer,
             final HttpContext context,
@@ -79,7 +81,7 @@ public class CXFAsyncRequester {
         HttpHost target = requestProducer.getTarget();
         this.connManager.leaseConnection(
                 target, null, 
-                -1, TimeUnit.MILLISECONDS,
+                csPolicy.getConnectionTimeout(), TimeUnit.MILLISECONDS,
                 new ConnRequestCallback<T>(
                 future, requestProducer, responseConsumer, context));
         return future;



Mime
View raw message