servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r571093 - in /incubator/servicemix/trunk/deployables: bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ serviceengines/servicemix-cxf-se/src/main/java/org/apache/servicemix/cxfse/
Date Thu, 30 Aug 2007 09:34:21 GMT
Author: ffang
Date: Thu Aug 30 02:34:21 2007
New Revision: 571093

URL: http://svn.apache.org/viewvc?rev=571093&view=rev
Log:
[SM-939]fix cocurrent request ocassionally failed problem in CXF SE&BC

Modified:
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-cxf-se/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java?rev=571093&r1=571092&r2=571093&view=diff
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCSESystemTest.java
Thu Aug 30 02:34:21 2007
@@ -46,6 +46,43 @@
                     "Negative number cant be added!");
         }
     }
+    
+    public void testMultiClient() throws Exception {
+        URL wsdl = getClass().getResource("/wsdl/calculator.wsdl");
+        assertNotNull(wsdl);
+        CalculatorService service = new CalculatorService(wsdl, new QName(
+                "http://apache.org/cxf/calculator", "CalculatorService"));
+        CalculatorPortType port = service.getCalculatorPort();
+        MultiClientThread[] clients = new MultiClientThread[10];
+        for (int i = 0; i < clients.length; i++) {
+            clients[i] = new MultiClientThread(port);
+        }
+        
+        for (int i = 0; i < clients.length; i++) {
+            clients[i].start();
+        }
+        
+        for (int i = 0; i < clients.length; i++) {
+            clients[i].join();
+        }
+    }
+    
+    class MultiClientThread extends Thread {
+        private CalculatorPortType port;
+        
+        public MultiClientThread(CalculatorPortType port) {
+            this.port = port;
+        }
+        
+        public void run() {
+            try {
+                assertEquals(port.add(1, 2), 3);
+            } catch (AddNumbersFault e) {
+                // TODO Auto-generated catch block
+                fail();
+            }
+        }
+    }
 
     @Override
     protected AbstractXmlApplicationContext createBeanFactory() {

Modified: incubator/servicemix/trunk/deployables/serviceengines/servicemix-cxf-se/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-cxf-se/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java?rev=571093&r1=571092&r2=571093&view=diff
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-cxf-se/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java
(original)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-cxf-se/src/main/java/org/apache/servicemix/cxfse/CxfSeEndpoint.java
Thu Aug 30 02:34:21 2007
@@ -64,7 +64,6 @@
 
     private String address;
 
-
     private List<Interceptor> in = new CopyOnWriteArrayList<Interceptor>();
 
     private List<Interceptor> out = new CopyOnWriteArrayList<Interceptor>();
@@ -155,21 +154,17 @@
      */
     @Override
     public void process(MessageExchange exchange) throws Exception {
-        JBITransportFactory jbiTransportFactory =
-            (JBITransportFactory)getBus().getExtension(ConduitInitiatorManager.class).
-                    getConduitInitiator(CxfSeComponent.JBI_TRANSPORT_ID);
-        JBIDestination jbiDestination = jbiTransportFactory.getDestination(exchange.getService().toString()
-                           + exchange.getInterfaceName().toString());
-        DeliveryChannel oldDc = jbiDestination.getDeliveryChannel();
-        try {
-            jbiDestination.setDeliveryChannel(getContext()
-                    .getDeliveryChannel());
-         
-            if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
-                jbiDestination.getJBIDispatcherUtil().dispatch(exchange);
-            }
-        } finally {
-            jbiDestination.setDeliveryChannel(oldDc);
+        JBITransportFactory jbiTransportFactory = (JBITransportFactory) getBus()
+                .getExtension(ConduitInitiatorManager.class)
+                .getConduitInitiator(CxfSeComponent.JBI_TRANSPORT_ID);
+        JBIDestination jbiDestination = jbiTransportFactory
+                .getDestination(exchange.getService().toString()
+                        + exchange.getInterfaceName().toString());
+        DeliveryChannel dc = getContext().getDeliveryChannel();
+        
+        jbiDestination.setDeliveryChannel(dc);
+        if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
+            jbiDestination.getJBIDispatcherUtil().dispatch(exchange);
         }
     }
 
@@ -183,14 +178,13 @@
         super.start();
         address = "jbi://" + ID_GENERATOR.generateSanitizedId();
         endpoint.publish(address);
-        setService(endpoint.getServer().getEndpoint().getService()
-                .getName());
-        setEndpoint(endpoint.getServer().getEndpoint()
-                .getEndpointInfo().getName().getLocalPart());
+        setService(endpoint.getServer().getEndpoint().getService().getName());
+        setEndpoint(endpoint.getServer().getEndpoint().getEndpointInfo()
+                .getName().getLocalPart());
         try {
-            definition = new ServiceWSDLBuilder(getBus(), endpoint
-                    .getServer().getEndpoint().getService()
-                    .getServiceInfos().iterator().next()).build();
+            definition = new ServiceWSDLBuilder(getBus(), endpoint.getServer()
+                    .getEndpoint().getService().getServiceInfos().iterator()
+                    .next()).build();
         } catch (WSDLException e) {
             throw new DeploymentException(e);
         }



Mime
View raw message