[CXF-7122]remove unnecessary Timer (cherry picked from commit caac861613b4df07eb3ff4023e1b9e53b07cd5ea)
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c06cc6dc Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c06cc6dc Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c06cc6dc Branch: refs/heads/3.1.x-fixes Commit: c06cc6dcf2183eb9561a5d18af33b4563bf9a2fb Parents: ffdb1bb Author: Freeman Fang <[email protected]> Authored: Tue Nov 8 15:56:18 2016 +0800 Committer: Freeman Fang <[email protected]> Committed: Tue Nov 8 16:00:33 2016 +0800 ---------------------------------------------------------------------- .../http/asyncclient/AsyncHTTPConduit.java | 25 -------------------- .../asyncclient/AsyncHTTPConduitFactory.java | 3 +-- .../http/asyncclient/SharedOutputBuffer.java | 1 - 3 files changed, 1 insertion(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/c06cc6dc/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 7123ee9..4b4b934 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 @@ -38,7 +38,6 @@ import java.security.cert.Certificate; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.TimerTask; import java.util.concurrent.Future; import java.util.logging.Level; @@ -53,13 +52,11 @@ import org.apache.cxf.Bus; import org.apache.cxf.common.util.StringUtils; import org.apache.cxf.configuration.jsse.SSLUtils; import org.apache.cxf.configuration.jsse.TLSClientParameters; -import org.apache.cxf.endpoint.ClientCallback; import org.apache.cxf.helpers.HttpHeaderHelper; import org.apache.cxf.helpers.IOUtils; import org.apache.cxf.io.CacheAndWriteOutputStream; import org.apache.cxf.io.CachedOutputStream; import org.apache.cxf.io.CopyingOutputStream; -import org.apache.cxf.message.Exchange; import org.apache.cxf.message.Message; import org.apache.cxf.message.MessageUtils; import org.apache.cxf.service.model.EndpointInfo; @@ -650,7 +647,6 @@ public class AsyncHTTPConduit extends URLConnectionHTTPConduit { protected void handleResponseAsync() throws IOException { isAsync = true; -// factory.timer.schedule(new CheckReceiveTimeoutForAsync(), csPolicy.getReceiveTimeout()); } protected void closeInputStream() throws IOException { @@ -867,29 +863,8 @@ public class AsyncHTTPConduit extends URLConnectionHTTPConduit { } } - class CheckReceiveTimeoutForAsync extends TimerTask { - public void run() { - - if (httpResponse == null) { - outbuf.shutdown(); - inbuf.shutdown(); - if (exception != null) { - throw new RuntimeException(exception); - } - - Exchange exchange = outMessage.getExchange(); - // remove callback so that it won't be invoked twice - ClientCallback cc = exchange.remove(ClientCallback.class); - if (cc != null) { - cc.handleException(null, new SocketTimeoutException()); - } - } - } - } - } - public synchronized SSLContext getSSLContext(TLSClientParameters tlsClientParameters) throws GeneralSecurityException { http://git-wip-us.apache.org/repos/asf/cxf/blob/c06cc6dc/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java ---------------------------------------------------------------------- diff --git a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java index d4ac6b1..ba0c2ea 100644 --- a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java +++ b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java @@ -21,7 +21,6 @@ package org.apache.cxf.transport.http.asyncclient; import java.io.IOException; import java.util.Map; -import java.util.Timer; import java.util.concurrent.TimeUnit; import org.apache.cxf.Bus; @@ -132,7 +131,7 @@ public class AsyncHTTPConduitFactory implements HTTPConduitFactory { int soTimeout = IOReactorConfig.DEFAULT.getSoTimeout(); boolean soKeepalive = IOReactorConfig.DEFAULT.isSoKeepalive(); boolean tcpNoDelay = true; - Timer timer = new Timer(); + AsyncHTTPConduitFactory() { super(); http://git-wip-us.apache.org/repos/asf/cxf/blob/c06cc6dc/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/SharedOutputBuffer.java ---------------------------------------------------------------------- diff --git a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/SharedOutputBuffer.java b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/SharedOutputBuffer.java index 49cb9d6..1e3ed96 100644 --- a/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/SharedOutputBuffer.java +++ b/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/SharedOutputBuffer.java @@ -118,7 +118,6 @@ public class SharedOutputBuffer extends ExpandableBuffer { public int produceContent(final ContentEncoder encoder, final IOControl ioc) throws IOException { if (this.shutdown) { - encoder.complete(); return -1; } this.lock.lock();
