[jboss-cvs] JBoss Messaging SVN: r5505 - in branches/Branch_1_4: src/main/org/jboss/messaging/core/contract and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Dec 10 09:32:07 EST 2008


Author: gaohoward
Date: 2008-12-10 09:32:06 -0500 (Wed, 10 Dec 2008)
New Revision: 5505

Modified:
   branches/Branch_1_4/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
   branches/Branch_1_4/src/main/org/jboss/messaging/core/contract/Delivery.java
   branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/ChannelSupport.java
   branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/SimpleDelivery.java
   branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
Log:
JBMESSAGING-1440


Modified: branches/Branch_1_4/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java	2008-12-10 14:15:58 UTC (rev 5504)
+++ branches/Branch_1_4/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java	2008-12-10 14:32:06 UTC (rev 5505)
@@ -1203,7 +1203,13 @@
 
          DeliveryRecord rec = (DeliveryRecord)entry.getValue();
 
-         rec.del.cancel();
+         /*
+          * https://jira.jboss.org/jira/browse/JBMESSAGING-1440
+          */
+         if (!rec.del.isXAPrepared())
+         {
+            rec.del.cancel();
+         }
 
          channels.add(rec.del.getObserver());
       }

Modified: branches/Branch_1_4/src/main/org/jboss/messaging/core/contract/Delivery.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/messaging/core/contract/Delivery.java	2008-12-10 14:15:58 UTC (rev 5504)
+++ branches/Branch_1_4/src/main/org/jboss/messaging/core/contract/Delivery.java	2008-12-10 14:32:06 UTC (rev 5505)
@@ -50,8 +50,7 @@
    boolean isRecovered();
 
    /**
-    * Mark if this delivery is with XA transaction.
-    * propagated from the receiver.
+    * Mark if this delivery is with a prepared XA transaction.
     */
-   boolean isXA();
+   boolean isXAPrepared();
 }

Modified: branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/ChannelSupport.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/ChannelSupport.java	2008-12-10 14:15:58 UTC (rev 5504)
+++ branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/ChannelSupport.java	2008-12-10 14:32:06 UTC (rev 5505)
@@ -313,13 +313,7 @@
 
       if (!checkAndSchedule(ref))
       {
-         /*
-          * https://jira.jboss.org/jira/browse/JBMESSAGING-1440
-          */
-         if (!del.isXA()) 
-         {
-            cancelInternal(ref);
-         }
+         cancelInternal(ref);
       }
    }
 

Modified: branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/SimpleDelivery.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/SimpleDelivery.java	2008-12-10 14:15:58 UTC (rev 5504)
+++ branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/SimpleDelivery.java	2008-12-10 14:32:06 UTC (rev 5505)
@@ -50,7 +50,7 @@
    private DeliveryObserver observer;
    private MessageReference reference;   
    private boolean recovered;
-   private boolean xa;
+   private Transaction tx;
 
    private boolean trace = log.isTraceEnabled();
 
@@ -74,7 +74,7 @@
       this.observer = observer;
       this.selectorAccepted = selectorAccepted;
       this.recovered = recovered;
-      this.xa = false;
+      this.tx = null;
    }
 
    // Delivery implementation ----------------------------------------------------------------------
@@ -97,16 +97,9 @@
    public void acknowledge(Transaction tx) throws Throwable
    {        
       if (trace) { log.trace(this + " acknowledging delivery " + ( tx == null ? "non-transactionally" : "in " + tx)); }
+
+      this.tx = tx;
       
-      if (tx.getXid() != null)
-      {
-         xa = true;
-      }
-      else
-      {
-         xa = false;
-      }
-      
       observer.acknowledge(this, tx);
    }
 
@@ -132,9 +125,15 @@
    /* (non-Javadoc)
     * @see org.jboss.messaging.core.contract.Delivery#isXA()
     */
-   public boolean isXA()
+   public boolean isXAPrepared()
    {
-      return xa;
+      if (tx != null) {
+         if (tx.getXid() != null)
+         {
+            return tx.getState() == Transaction.STATE_PREPARED;
+         }
+      }
+      return false;
    }
 
    // Package protected ----------------------------------------------------------------------------

Modified: branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java	2008-12-10 14:15:58 UTC (rev 5504)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java	2008-12-10 14:32:06 UTC (rev 5505)
@@ -3674,7 +3674,7 @@
 
          res4.commit(xids[0], false);
 
-         //The message should be received
+         //The message should never be received again
 
          conn4.close();
          conn4 = null;




More information about the jboss-cvs-commits mailing list