servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1156465 - /servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
Date Thu, 11 Aug 2011 03:48:56 GMT
Author: ffang
Date: Thu Aug 11 03:48:56 2011
New Revision: 1156465

URL: http://svn.apache.org/viewvc?rev=1156465&view=rev
Log:
[SMXCOMP-897]ensure cxf servlet transport and cxf bc can share same bus out of box when deploy
smx-cxf-bc in web container

Modified:
    servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java

Modified: servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=1156465&r1=1156464&r2=1156465&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
(original)
+++ servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
Thu Aug 11 03:48:56 2011
@@ -310,7 +310,8 @@ public class CxfBcConsumer extends Consu
         
         boolean oneway = message.getExchange().get(BindingOperationInfo.class)
                 .getOperationInfo().isOneWay();
-        if (!isSynchronous() && !oneway) {
+        if (!isSynchronous() && !oneway 
+            && !isServletTransport()) {
             if (isNativeAsyn(message)) {
                 message.getInterceptorChain().resume();
             } else {
@@ -327,6 +328,10 @@ public class CxfBcConsumer extends Consu
         }
     }
 
+    private boolean isServletTransport() {
+        return locationURI != null && locationURI.startsWith("/");
+    }
+
     @Override
     public void activate() throws Exception {
         super.activate();
@@ -671,13 +676,18 @@ public class CxfBcConsumer extends Consu
 
     protected Bus getBus() {
         Bus ret = null;
+        if (isServletTransport()) {
+            //it's serlvet transport, using the bus from CXFNonSpringServlet
+            ret = BusFactory.getDefaultBus();
+            return ret;
+        }
         if (providedBus != null) {
             ret = providedBus;
         } else if (getBusCfg() != null) {
             if (bus == null) {
                 SpringBusFactory bf = new SpringBusFactory();
                 bus = bf.createBus(getBusCfg());
-                if (locationURI != null && locationURI.startsWith("/")) {
+                if (isServletTransport()) {
                     //it's in the servlet container
                     //set this bus so that it could be used in CXFManagerServlet
                     BusFactory.setDefaultBus(bus);
@@ -828,8 +838,9 @@ public class CxfBcConsumer extends Consu
             	if (CxfBcConsumer.this.isOneway) {
                         CxfBcConsumer.this.messages.put(exchange.getExchangeId(), message);
             		context.getDeliveryChannel().send(exchange);
-            	} else if (CxfBcConsumer.this.isSynchronous()
-                        && !CxfBcConsumer.this.isOneway) {
+            	} else if ((CxfBcConsumer.this.isSynchronous()
+                        && !CxfBcConsumer.this.isOneway)
+                        || isServletTransport()) {
                     CxfBcConsumer.this.messages.put(exchange.getExchangeId(), message);
                     context.getDeliveryChannel().sendSync(exchange,
                             timeout * 1000);



Mime
View raw message