Author: gnodet
Date: Wed Jun 18 13:19:50 2008
New Revision: 669278

URL: http://svn.apache.org/viewvc?rev=669278&view=rev
Log:
CXF-1658: The jbi transport should honor the sendSync flag so that xa 
transactions are handled correctly in smx3

Modified:
    
cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java

Modified: 
cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java?rev=669278&r1=669277&r2=669278&view=diff
==============================================================================
--- 
cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java
 (original)
+++ 
cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java
 Wed Jun 18 13:19:50 2008
@@ -26,6 +26,7 @@
 import java.util.logging.Logger;
 
 import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.ExchangeStatus;
 import javax.jbi.messaging.Fault;
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.messaging.NormalizedMessage;
@@ -42,6 +43,8 @@
 
 public class JBIDestinationOutputStream extends CachedOutputStream {
 
+    private static final String SEND_SYNC = "javax.jbi.messaging.sendSync";
+
     private static final Logger LOG = 
LogUtils.getL7dLogger(JBIDestinationOutputStream.class);
     private Message inMessage;
     private Message outMessage;
@@ -119,12 +122,17 @@
                 }
                 LOG.fine(new org.apache.cxf.common.i18n.Message(
                     "POST.DISPATCH", LOG).toString());
-                channel.send(xchng);
+                if (xchng.getStatus() == ExchangeStatus.ACTIVE
+                        && Boolean.TRUE.equals(xchng.getProperty(SEND_SYNC))) {
+                    channel.sendSync(xchng);
+                } else {
+                    channel.send(xchng);
+                }
             }
         } catch (Exception ex) { 
             LOG.log(Level.SEVERE, new org.apache.cxf.common.i18n.Message(
                 "ERROR.SEND.MESSAGE", LOG).toString(), ex);
         }
     }
-    
+
 }


Reply via email to