servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r636648 - in /servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src: main/java/org/apache/servicemix/cxfbc/ test/java/org/apache/servicemix/cxfbc/
Date Thu, 13 Mar 2008 07:09:43 GMT
Author: ffang
Date: Thu Mar 13 00:09:29 2008
New Revision: 636648

URL: http://svn.apache.org/viewvc?rev=636648&view=rev
Log:
[SM-1272]cocurrency problem in cxf bc provider

Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderTest.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/GreeterImplForProvider.java

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java?rev=636648&r1=636647&r2=636648&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
Thu Mar 13 00:09:29 2008
@@ -101,14 +101,14 @@
     
     private Bus bus;
     
+    private ConduitInitiator conduitInit;
+    
     private URI locationURI;
     
     private EndpointInfo ei;
     
     private Endpoint ep;
 
-    private Conduit conduit;
-    
     private Service cxfService;
     
     private boolean mtomEnabled;
@@ -128,7 +128,7 @@
         }
         NormalizedMessage nm = exchange.getMessage("in");
         
-               
+        Conduit conduit = conduitInit.getConduit(ei);               
         CxfBcProviderMessageObserver obs = new CxfBcProviderMessageObserver(exchange, this);
         conduit.setMessageObserver(obs);
         Message message = ep.getBinding().createMessage();
@@ -287,11 +287,7 @@
                 ei.setAddress(locationURI.toString());
                 
                 ConduitInitiatorManager conduitMgr = getBus().getExtension(ConduitInitiatorManager.class);
-                ConduitInitiator conduitInit = conduitMgr.getConduitInitiator("http://schemas.xmlsoap.org/soap/http");
-                conduit = conduitInit.getConduit(ei);
-
-                
-
+                conduitInit = conduitMgr.getConduitInitiator("http://schemas.xmlsoap.org/soap/http");
                 super.validate();
             }
         } catch (DeploymentException e) {

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java?rev=636648&r1=636647&r2=636648&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
Thu Mar 13 00:09:29 2008
@@ -140,7 +140,6 @@
             try {
                 assertEquals(port.add(1, 2), 3);
             } catch (AddNumbersFault e) {
-                // TODO Auto-generated catch block
                 fail();
             }
         }

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderTest.java?rev=636648&r1=636647&r2=636648&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderTest.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderTest.java
Thu Mar 13 00:09:29 2008
@@ -142,6 +142,23 @@
         client.sendSync(io);
         assertTrue(new SourceTransformer().contentToString(
                 io.getOutMessage()).indexOf("Hello oneway test oneway") >= 0);
+        
+        //test concurrency
+        io = client.createInOutExchange();
+        io.setService(new QName("http://apache.org/hello_world_soap_http", "SOAPServiceProvider"));
+        io.setInterfaceName(new QName("http://apache.org/hello_world_soap_http", "Greeter"));
+        io.setOperation(new QName("http://apache.org/hello_world_soap_http", "greetMe"));
+        io.getInMessage().setContent(new StringSource(
+                "<message xmlns='http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper'>"
+              + "<part> "
+              + "<greetMe xmlns='http://apache.org/hello_world_soap_http/types'><requestType>"
+              + "concurrency test"
+              + "</requestType></greetMe>"
+              + "</part> "
+              + "</message>"));
+        client.sendSync(io);
+        assertTrue(new SourceTransformer().contentToString(
+                io.getOutMessage()).indexOf("Hello concurrency test 0 2 4 6 8 10 12 14 16
18") >= 0);
     }
     
      

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/GreeterImplForProvider.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/GreeterImplForProvider.java?rev=636648&r1=636647&r2=636648&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/GreeterImplForProvider.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/GreeterImplForProvider.java
Thu Mar 13 00:09:29 2008
@@ -16,19 +16,32 @@
  */
 package org.apache.servicemix.cxfbc;
 
+import java.util.concurrent.Future;
+
 import javax.jbi.component.ComponentContext;
 import javax.jws.WebService;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
 
 import org.apache.cxf.calculator.AddNumbersFault;
 import org.apache.cxf.calculator.CalculatorPortType;
+import org.apache.hello_world_soap_http.BadRecordLitFault;
 import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.NoSuchCodeLitFault;
+import org.apache.hello_world_soap_http.types.GreetMeLaterResponse;
+import org.apache.hello_world_soap_http.types.GreetMeResponse;
+import org.apache.hello_world_soap_http.types.GreetMeSometimeResponse;
+import org.apache.hello_world_soap_http.types.SayHiResponse;
+import org.apache.hello_world_soap_http.types.TestDocLitFaultResponse;
+import org.apache.hello_world_soap_http.types.TestNillableResponse;
+
 
 @WebService(serviceName = "SOAPServiceProvider", 
         portName = "SoapPort", 
         endpointInterface = "org.apache.hello_world_soap_http.Greeter", 
         targetNamespace = "http://apache.org/hello_world_soap_http")
 
-public class GreeterImplForProvider {
+public class GreeterImplForProvider implements Greeter {
     private ComponentContext context;
     private CalculatorPortType calculator;
     private Greeter greeter;
@@ -46,14 +59,38 @@
                 ret = "oneway";
             } else if ("https test".equals(me)) {
                 ret = ret + securityGreeter.greetMe("ffang");
+            } else if ("concurrency test".equals(me)) {
+                MultiClientThread[] clients = new MultiClientThread[10];
+                for (int i = 0; i < clients.length; i++) {
+                    clients[i] = new MultiClientThread(getCalculator(), i);
+                }
+                
+                for (int i = 0; i < clients.length; i++) {
+                    clients[i].start();
+                }
+                
+                for (int i = 0; i < clients.length; i++) {
+                    clients[i].join();
+                }
+                
+                for (int i = 0; i < clients.length; i++) {
+                    ret += i * 2 + " ";
+                }
             }
                         
         } catch (AddNumbersFault e) {
             //should catch exception here if negative number is passed
             ret = ret + e.getFaultInfo().getMessage();
+        } catch (InterruptedException e) {
+            //
         }
         return "Hello " + me  + " " + ret;
     }
+
+    public String greetMeLater(long requestType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
     
     public ComponentContext getContext() {
         return context;
@@ -87,5 +124,111 @@
         return securityGreeter;
     }
 
+    public Response<GreetMeResponse> greetMeAsync(String requestType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Future<?> greetMeAsync(String requestType, AsyncHandler<GreetMeResponse>
asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Response<GreetMeLaterResponse> greetMeLaterAsync(long requestType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Future<?> greetMeLaterAsync(long requestType, AsyncHandler<GreetMeLaterResponse>
asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void greetMeOneWay(String requestType) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public String greetMeSometime(String requestType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Response<GreetMeSometimeResponse> greetMeSometimeAsync(String requestType)
{
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Future<?> greetMeSometimeAsync(String requestType, AsyncHandler<GreetMeSometimeResponse>
asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String sayHi() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Response<SayHiResponse> sayHiAsync() {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
+    public Future<?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void testDocLitFault(String faultType) throws BadRecordLitFault, NoSuchCodeLitFault
{
+        // TODO Auto-generated method stub
+        
+    }
+
+    public Response<TestDocLitFaultResponse> testDocLitFaultAsync(String faultType)
{
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Future<?> testDocLitFaultAsync(String faultType, AsyncHandler<TestDocLitFaultResponse>
asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String testNillable(String nillElem, int intElem) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Response<TestNillableResponse> testNillableAsync(String nillElem, int intElem)
{
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Future<?> testNillableAsync(String nillElem, int intElem, AsyncHandler<TestNillableResponse>
asyncHandler) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    class MultiClientThread extends Thread {
+        private CalculatorPortType port;
+        private int index;
+        private int ret;
+        public MultiClientThread(CalculatorPortType port, int i) {
+            this.port = port;
+            this.index = i;
+        }
+        
+        public void run() {
+            try {
+                ret = port.add(index, index);
+            } catch (AddNumbersFault e) {
+                //  
+            }
+        }
+        
+        public int getRet() {
+            return ret;
+        }
+    }
 }



Mime
View raw message