Fix timeout handling by non async requests (cherry picked from commit 1c34659984b1c3a64463471166a4c772597c0ac8)
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5f4d837a Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5f4d837a Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5f4d837a Branch: refs/heads/3.1.x-fixes Commit: 5f4d837a723e97630053aac31797f6cc6eeb61f0 Parents: f3c121d Author: William Montaz <[email protected]> Authored: Thu Nov 3 15:03:52 2016 +0100 Committer: Freeman Fang <[email protected]> Committed: Tue Nov 8 15:59:13 2016 +0800 ---------------------------------------------------------------------- .../cxf/transport/http/asyncclient/AsyncHTTPConduit.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/5f4d837a/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 72c6ebf..76f333b 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 @@ -619,7 +619,11 @@ public class AsyncHTTPConduit extends URLConnectionHTTPConduit { while (httpResponse == null) { if (exception == null) { //already have an exception, skip waiting try { - wait(); + if (isAsync) { + wait(); + } else { + wait(csPolicy.getReceiveTimeout()); + } } catch (InterruptedException e) { throw new IOException(e); }
