servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r636644 - in /servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src: main/java/org/apache/servicemix/cxfbc/ test/java/org/apache/servicemix/cxfbc/
Date Thu, 13 Mar 2008 06:37:33 GMT
Author: ffang
Date: Wed Mar 12 23:37:31 2008
New Revision: 636644

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

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

Modified: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java?rev=636644&r1=636643&r2=636644&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
(original)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
Wed Mar 12 23:37:31 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/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java?rev=636644&r1=636643&r2=636644&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
(original)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
Wed Mar 12 23:37:31 2008
@@ -140,7 +140,6 @@
             try {
                 assertEquals(port.add(1, 2), 3);
             } catch (AddNumbersFault e) {
-                // TODO Auto-generated catch block
                 fail();
             }
         }

Modified: servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderTest.java?rev=636644&r1=636643&r2=636644&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderTest.java
(original)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderTest.java
Wed Mar 12 23:37:31 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/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/GreeterImplForProvider.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/GreeterImplForProvider.java?rev=636644&r1=636643&r2=636644&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/GreeterImplForProvider.java
(original)
+++ servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/GreeterImplForProvider.java
Wed Mar 12 23:37:31 2008
@@ -35,6 +35,7 @@
 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", 
@@ -58,11 +59,30 @@
                 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;
     }
@@ -190,4 +210,25 @@
     }
 
 
+    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