cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [1/3] git commit: [CXF-5695] Delay creation of the HTTPCOnduitFactory until needed
Date Wed, 16 Apr 2014 14:36:13 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 039ede868 -> 2f1d90f0f


[CXF-5695] Delay creation of the HTTPCOnduitFactory until needed

Conflicts:
	rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java


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

Branch: refs/heads/2.7.x-fixes
Commit: f82e754058fac5fe7a213b2a9f86782472043d32
Parents: 039ede8
Author: Daniel Kulp <dkulp@apache.org>
Authored: Wed Apr 16 10:24:03 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Wed Apr 16 10:31:44 2014 -0400

----------------------------------------------------------------------
 .../asyncclient/AsyncHTTPConduitFactory.java    | 22 ++++++++++----------
 .../http/asyncclient/AsyncHTTPConduitTest.java  |  7 +++++++
 2 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/f82e7540/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 b377450..ba65b1b 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
@@ -86,8 +86,7 @@ import org.apache.http.protocol.RequestUserAgent;
  * 
  */
 @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";
@@ -284,14 +283,7 @@ public class AsyncHTTPConduitFactory implements BusLifeCycleListener,
HTTPCondui
     public void setBus(Bus b) {
         addListener(b);
     }
-    public void initComplete() {
-    }
-    public synchronized void preShutdown() {
-        shutdown();
-    }
-    public void postShutdown() {
-    }    
-    
+
     public void shutdown() {
         if (ioReactor != null) {
             shutdown(ioReactor, connectionManager);
@@ -317,7 +309,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() {
+            }
+        });
     }
     
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/f82e7540/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 a52d741..33bae59 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
@@ -35,6 +35,7 @@ import org.apache.cxf.continuations.ContinuationProvider;
 import org.apache.cxf.frontend.ClientProxy;
 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;
@@ -60,7 +61,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) {


Mime
View raw message