You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2016/11/08 09:25:15 UTC

[4/5] cxf git commit: Fix socket timeout and connection request timeout from AsyncHTTPClient

Fix socket timeout and connection request timeout from AsyncHTTPClient

(cherry picked from commit 4c6a9aaf61b5651d4fe0bb077e052bcd5196be71)


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

Branch: refs/heads/3.1.x-fixes
Commit: ffdb1bb25b4f61bbb2481444ddd55a98e39cac20
Parents: 5f4d837
Author: William Montaz <wm...@voyages-sncf.com>
Authored: Mon Nov 7 11:04:20 2016 +0100
Committer: Freeman Fang <fr...@gmail.com>
Committed: Tue Nov 8 16:00:19 2016 +0800

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


http://git-wip-us.apache.org/repos/asf/cxf/blob/ffdb1bb2/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 {