[jboss-cvs] JBoss Messaging SVN: r2614 - trunk/src/main/org/jboss/jms/client/container.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Apr 26 15:37:57 EDT 2007


Author: clebert.suconic at jboss.com
Date: 2007-04-26 15:37:57 -0400 (Thu, 26 Apr 2007)
New Revision: 2614

Modified:
   trunk/src/main/org/jboss/jms/client/container/SessionAspect.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-946 - Fixing consumers and MDBs behaviors

Modified: trunk/src/main/org/jboss/jms/client/container/SessionAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/SessionAspect.java	2007-04-26 18:54:39 UTC (rev 2613)
+++ trunk/src/main/org/jboss/jms/client/container/SessionAspect.java	2007-04-26 19:37:57 UTC (rev 2614)
@@ -33,6 +33,7 @@
 import javax.jms.ServerSessionPool;
 import javax.jms.Session;
 import javax.jms.TransactionInProgressException;
+import javax.jms.ServerSession;
 
 import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.aop.joinpoint.MethodInvocation;
@@ -248,7 +249,11 @@
                   
          state.getClientAckList().add(info);
       }
-      else if (ackMode == Session.AUTO_ACKNOWLEDGE)
+      // if XA and there is no transaction enlisted on XA we will act as AutoAcknowledge
+      // However if it's a MDB (or ServerSession) we should behaved as transacted
+      else if (ackMode == Session.AUTO_ACKNOWLEDGE ||
+               (state.isXA() && (state.getCurrentTxId() instanceof LocalTx) &&
+                  !(state.getDistinguishedListener() instanceof ServerSession)))
       {
          // We collect the single acknowledgement in the state. 
                            
@@ -302,8 +307,12 @@
       SessionState state = getState(invocation);
       
       int ackMode = state.getAcknowledgeMode();
-      
-      if (ackMode == Session.AUTO_ACKNOWLEDGE)
+
+      // if XA and there is no transaction enlisted on XA we will act as AutoAcknowledge
+      // However if it's a MDB (or ServerSession) we should behaved as transacted
+      if (ackMode == Session.AUTO_ACKNOWLEDGE ||
+         (state.isXA() && (state.getCurrentTxId() instanceof LocalTx) &&
+                  !(state.getDistinguishedListener() instanceof ServerSession)))
       {
          // We auto acknowledge.
 




More information about the jboss-cvs-commits mailing list