cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject [4/7] cxf git commit: Fix socket timeout and connection request timeout from AsyncHTTPClient
Date Tue, 08 Nov 2016 07:56:44 GMT
Fix socket timeout and connection request timeout from AsyncHTTPClient


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4c6a9aaf
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4c6a9aaf
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4c6a9aaf

Branch: refs/heads/master
Commit: 4c6a9aaf61b5651d4fe0bb077e052bcd5196be71
Parents: 1c34659
Author: William Montaz <wmontaz@voyages-sncf.com>
Authored: Mon Nov 7 11:04:20 2016 +0100
Committer: William Montaz <wmontaz@voyages-sncf.com>
Committed: Mon Nov 7 11:04:20 2016 +0100

----------------------------------------------------------------------
 .../transport/http/asyncclient/AsyncHTTPConduit.java    | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/4c6a9aaf/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
index 76f333b..7123ee9 100755
--- a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
+++ b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
@@ -220,7 +220,9 @@ public class AsyncHTTPConduit extends URLConnectionHTTPConduit {
         e.setEntity(entity);
 
         RequestConfig.Builder b = RequestConfig.custom()
-            .setConnectTimeout((int) csPolicy.getConnectionTimeout());
+                .setConnectTimeout((int) csPolicy.getConnectionTimeout())
+                .setSocketTimeout((int) csPolicy.getReceiveTimeout())
+                .setConnectionRequestTimeout((int) csPolicy.getReceiveTimeout());
         Proxy p = proxyFactory.createProxy(csPolicy, uri);
         if (p != null && p.type() != Proxy.Type.DIRECT) {
             InetSocketAddress isa = (InetSocketAddress)p.address();
@@ -619,11 +621,7 @@ public class AsyncHTTPConduit extends URLConnectionHTTPConduit {
             while (httpResponse == null) {
                 if (exception == null) { //already have an exception, skip waiting
                     try {
-                        if (isAsync) {
-                            wait();
-                        } else {
-                            wait(csPolicy.getReceiveTimeout());
-                        }
+                        wait();
                     } catch (InterruptedException e) {
                         throw new IOException(e);
                     }
@@ -652,7 +650,7 @@ public class AsyncHTTPConduit extends URLConnectionHTTPConduit {
         
         protected void handleResponseAsync() throws IOException {
             isAsync = true;
-            factory.timer.schedule(new CheckReceiveTimeoutForAsync(), csPolicy.getReceiveTimeout());
+//            factory.timer.schedule(new CheckReceiveTimeoutForAsync(), csPolicy.getReceiveTimeout());
         }
         
         protected void closeInputStream() throws IOException {


Mime
View raw message