You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/09/11 23:38:12 UTC

svn commit: r1383628 - in /cxf/sandbox/dkulp_async_clients/http-hc: ./ src/main/java/org/apache/cxf/transport/http/asyncclient/ src/main/resources/META-INF/cxf/ src/main/resources/OSGI-INF/ src/main/resources/OSGI-INF/blueprint/ src/test/java/org/apach...

Author: dkulp
Date: Tue Sep 11 21:38:11 2012
New Revision: 1383628

URL: http://svn.apache.org/viewvc?rev=1383628&view=rev
Log:
Start getting it working in OSGi

Added:
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/resources/OSGI-INF/
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/resources/OSGI-INF/blueprint/
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/resources/OSGI-INF/blueprint/cxf-http-async.xml
Modified:
    cxf/sandbox/dkulp_async_clients/http-hc/pom.xml
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java
    cxf/sandbox/dkulp_async_clients/http-hc/src/main/resources/META-INF/cxf/bus-extensions.txt
    cxf/sandbox/dkulp_async_clients/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java

Modified: cxf/sandbox/dkulp_async_clients/http-hc/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/pom.xml?rev=1383628&r1=1383627&r2=1383628&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/pom.xml (original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/pom.xml Tue Sep 11 21:38:11 2012
@@ -22,7 +22,7 @@
     <artifactId>cxf-rt-transports-http-hc</artifactId>
     <packaging>jar</packaging>
     <version>2.7.0-SNAPSHOT</version>
-    <name>Apache CXF Runtime HTTP Transport</name>
+    <name>Apache CXF Runtime HTTP Async Transport</name>
     <description>Apache CXF Runtime HTTP Async Transport</description>
     <url>http://cxf.apache.org</url>
 

Modified: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java?rev=1383628&r1=1383627&r2=1383628&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java (original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java Tue Sep 11 21:38:11 2012
@@ -101,7 +101,9 @@ public class AsyncHTTPConduit extends UR
     volatile Object sslState; 
     volatile SSLContext sslContext;
     
-    public AsyncHTTPConduit(Bus b, EndpointInfo ei, EndpointReferenceType t,
+    public AsyncHTTPConduit(Bus b, 
+                            EndpointInfo ei, 
+                            EndpointReferenceType t,
                             AsyncHTTPConduitFactory factory) throws IOException {
         super(b, ei, t);
         this.factory = factory;
@@ -124,9 +126,7 @@ public class AsyncHTTPConduit extends UR
             o = DEFAULT_FORCE_ASYNC;
         }
         if (o == null) {
-            //o = !message.getExchange().isSynchronous();
-            //o = "http".equals(s);
-            o = Boolean.TRUE;
+            o = !message.getExchange().isSynchronous();
         }
         if (!MessageUtils.isTrue(o)) {
             message.put(USE_ASYNC, Boolean.FALSE);

Modified: cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java?rev=1383628&r1=1383627&r2=1383628&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java (original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitFactory.java Tue Sep 11 21:38:11 2012
@@ -30,8 +30,8 @@ import org.apache.cxf.buslifecycle.BusLi
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.http.HTTPConduit;
+import org.apache.cxf.transport.http.HTTPConduitFactory;
 import org.apache.cxf.transport.http.HTTPTransportFactory;
-import org.apache.cxf.transport.http.HTTPTransportFactory.HTTPConduitFactory;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponseFactory;
@@ -62,16 +62,22 @@ import org.apache.http.params.HttpParams
  */
 @NoJSR250Annotations(unlessNull = "bus")
 public class AsyncHTTPConduitFactory implements BusLifeCycleListener, HTTPConduitFactory {
+    final IOReactorConfig config;
     CXFAsyncRequester requester;
     ConnectingIOReactor ioReactor;
     PoolingClientAsyncConnectionManager connectionManager;
     boolean isShutdown;
     
-    public AsyncHTTPConduitFactory() {
+    public AsyncHTTPConduitFactory(IOReactorConfig conf) {
         super();
+        config = conf;
     }
+    
+    
     public AsyncHTTPConduitFactory(Bus b) {
         addListener(b);
+        config = new IOReactorConfig();
+        config.setTcpNoDelay(true);
     }
 
     public boolean isShutdown() {
@@ -79,7 +85,8 @@ public class AsyncHTTPConduitFactory imp
     }
     
     @Override
-    public HTTPConduit createConduit(HTTPTransportFactory f, EndpointInfo localInfo,
+    public HTTPConduit createConduit(HTTPTransportFactory f, 
+                                     EndpointInfo localInfo,
                                      EndpointReferenceType target) throws IOException {
         if (isShutdown) {
             return null;
@@ -124,12 +131,10 @@ public class AsyncHTTPConduitFactory imp
             return;
         }
         // Create client-side I/O reactor
-        IOReactorConfig config = new IOReactorConfig();
-        config.setTcpNoDelay(true);
-        
         final IOEventDispatch ioEventDispatch = new DefaultHttpClientIODispatch(new HttpAsyncRequestExecutor(),
                                                                                 new BasicHttpParams());
         ioReactor = new DefaultConnectingIOReactor(config);
+        
 
         // Run the I/O reactor in a separate thread
         Thread t = new Thread(new Runnable() {

Modified: cxf/sandbox/dkulp_async_clients/http-hc/src/main/resources/META-INF/cxf/bus-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/resources/META-INF/cxf/bus-extensions.txt?rev=1383628&r1=1383627&r2=1383628&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/resources/META-INF/cxf/bus-extensions.txt (original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/resources/META-INF/cxf/bus-extensions.txt Tue Sep 11 21:38:11 2012
@@ -1,2 +1,2 @@
-org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduitFactory:org.apache.cxf.transport.http.HTTPTransportFactory$HTTPConduitFactory:true
+org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduitFactory:org.apache.cxf.transport.http.HTTPConduitFactory:true
 

Added: cxf/sandbox/dkulp_async_clients/http-hc/src/main/resources/OSGI-INF/blueprint/cxf-http-async.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/main/resources/OSGI-INF/blueprint/cxf-http-async.xml?rev=1383628&view=auto
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/main/resources/OSGI-INF/blueprint/cxf-http-async.xml (added)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/main/resources/OSGI-INF/blueprint/cxf-http-async.xml Tue Sep 11 21:38:11 2012
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
+
+           xsi:schemaLocation="
+            http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+  <cm:property-placeholder persistent-id="org.apache.cxf.transport.http.async" id="cxfAsyncOsgiProperties">
+
+    <cm:default-properties>
+      <!-- cm:property name="org.apache.cxf.transport.http.async.ioThreadCount" value="-1"/-->
+      <cm:property name="org.apache.cxf.transport.http.async.tcpNoDelay" value="true"/>
+    </cm:default-properties>
+
+  </cm:property-placeholder>
+  
+  
+  <bean id="destinationRegistry" class="org.apache.cxf.transport.http.DestinationRegistryImpl"/>
+
+  <bean id="osgiAsyncCondFact" class="org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduitFactory">
+    <argument>
+        <bean class="org.apache.http.impl.nio.reactor.IOReactorConfig">
+            <property name="tcpNoDelay" value="${org.apache.cxf.transport.http.async.tcpNoDelay}"/>
+        </bean>
+    </argument>
+  </bean>
+
+  <service ref="osgiAsyncCondFact" interface="org.apache.cxf.transport.http.HTTPConduitFactory"/>
+
+</blueprint>
+  
+  
+  
\ No newline at end of file

Modified: cxf/sandbox/dkulp_async_clients/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/dkulp_async_clients/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java?rev=1383628&r1=1383627&r2=1383628&view=diff
==============================================================================
--- cxf/sandbox/dkulp_async_clients/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java (original)
+++ cxf/sandbox/dkulp_async_clients/http-hc/src/test/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduitTest.java Tue Sep 11 21:38:11 2012
@@ -41,6 +41,7 @@ import org.apache.hello_world_soap_http.
 
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 
 
@@ -86,7 +87,7 @@ public class AsyncHTTPConduitTest extend
             });
         
         StringBuilder builder = new StringBuilder("NaNaNa");
-        for (int x = 0; x < 500000; x++) {
+        for (int x = 0; x < 50; x++) {
             builder.append(" NaNaNa ");
         }
         request = builder.toString();
@@ -159,6 +160,7 @@ public class AsyncHTTPConduitTest extend
     }
         
     @Test
+    @Ignore("peformance test")
     public void testCalls() throws Exception {
         updateAddressPort(g, PORT);
 
@@ -194,6 +196,7 @@ public class AsyncHTTPConduitTest extend
     }
     
     @Test
+    @Ignore("peformance test")
     public void testCallsAsync() throws Exception {
         updateAddressPort(g, PORT);