Repository: cxf Updated Branches: refs/heads/master caca7e113 -> a3f7f142a
[CXF-5695] Delay creation of the HTTPCOnduitFactory until needed Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a3f7f142 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a3f7f142 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a3f7f142 Branch: refs/heads/master Commit: a3f7f142a17da0d0fecd4fa039c07ba6e2496d49 Parents: caca7e1 Author: Daniel Kulp <[email protected]> Authored: Wed Apr 16 10:24:03 2014 -0400 Committer: Daniel Kulp <[email protected]> Committed: Wed Apr 16 10:28:13 2014 -0400 ---------------------------------------------------------------------- .../asyncclient/AsyncHTTPConduitFactory.java | 22 +++++++++----------- .../http/asyncclient/AsyncHTTPConduitTest.java | 7 +++++++ 2 files changed, 17 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/a3f7f142/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 d54e6dd..83deeb0 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 @@ -66,7 +66,7 @@ import org.apache.http.protocol.HttpContext; * */ @NoJSR250Annotations(unlessNull = "bus") -public class AsyncHTTPConduitFactory implements BusLifeCycleListener, HTTPConduitFactory { +public class AsyncHTTPConduitFactory implements HTTPConduitFactory { //TCP related properties public static final String TCP_NODELAY = "org.apache.cxf.transport.http.async.TCP_NODELAY"; @@ -252,16 +252,6 @@ public class AsyncHTTPConduitFactory implements BusLifeCycleListener, HTTPCondui addListener(b); } - public void initComplete() { - } - - public synchronized void preShutdown() { - shutdown(); - } - - public void postShutdown() { - } - public void shutdown() { if (client != null) { shutdown(client); @@ -281,7 +271,15 @@ public class AsyncHTTPConduitFactory implements BusLifeCycleListener, HTTPCondui private void addListener(Bus b) { - b.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(this); + b.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(new BusLifeCycleListener() { + public void initComplete() { + } + public void preShutdown() { + shutdown(); + } + public void postShutdown() { + } + }); } public synchronized void setupNIOClient(HTTPClientPolicy clientPolicy) throws IOReactorException { http://git-wip-us.apache.org/repos/asf/cxf/blob/a3f7f142/rt/transports/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java ---------------------------------------------------------------------- diff --git a/rt/transports/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java b/rt/transports/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java index e5fd08c..3341e3e 100644 --- a/rt/transports/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java +++ b/rt/transports/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java @@ -36,6 +36,7 @@ import org.apache.cxf.frontend.ClientProxy; import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; import org.apache.cxf.transport.http.HTTPConduit; +import org.apache.cxf.transport.http.HTTPConduitFactory; import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; import org.apache.hello_world_soap_http.Greeter; import org.apache.hello_world_soap_http.SOAPService; @@ -61,7 +62,13 @@ public class AsyncHTTPConduitTest extends AbstractBusClientServerTestBase { public static void start() throws Exception { Bus b = createStaticBus(); b.setProperty(AsyncHTTPConduit.USE_ASYNC, AsyncHTTPConduitFactory.UseAsyncPolicy.ALWAYS); + b.setProperty("org.apache.cxf.transport.http.async.MAX_CONNECTIONS", 501); + BusFactory.setThreadDefaultBus(b); + + AsyncHTTPConduitFactory hcf = (AsyncHTTPConduitFactory)b.getExtension(HTTPConduitFactory.class); + assertEquals(501, hcf.maxConnections); + ep = Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort", new org.apache.hello_world_soap_http.GreeterImpl() { public String greetMeLater(long cnt) {
