[hornetq-commits] JBoss hornetq SVN: r12157 - in trunk/hornetq-core: src/main/java/org/hornetq/core/server/impl and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Feb 21 17:21:51 EST 2012


Author: clebert.suconic at jboss.com
Date: 2012-02-21 17:21:51 -0500 (Tue, 21 Feb 2012)
New Revision: 12157

Added:
   trunk/hornetq-core/.settings/
Modified:
   trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ServerSessionImpl.java
Log:
https://issues.jboss.org/browse/HORNETQ-865 - properly updating reference counting in case of failures of the client

Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ServerSessionImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ServerSessionImpl.java	2012-02-21 15:42:48 UTC (rev 12156)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ServerSessionImpl.java	2012-02-21 22:21:51 UTC (rev 12157)
@@ -291,7 +291,7 @@
 
          try
          {
-            rollback(false);
+            rollback(failed, false);
          }
          catch (Exception e)
          {
@@ -634,8 +634,19 @@
       }
    }
 
-   public synchronized void rollback(final boolean considerLastMessageAsDelivered) throws Exception
+   public void rollback(final boolean considerLastMessageAsDelivered) throws Exception
    {
+	   rollback(false, considerLastMessageAsDelivered);
+   }
+
+   /**
+    * 
+    * @param clientFailed If the client has failed, we can't decrease the delivery-counts, and the close may issue a rollback
+    * @param considerLastMessageAsDelivered
+    * @throws Exception
+    */
+   private synchronized void rollback(final boolean clientFailed, final boolean considerLastMessageAsDelivered) throws Exception
+   {
       if (tx == null)
       {
          // Might be null if XA
@@ -643,7 +654,7 @@
          tx = new TransactionImpl(storageManager, timeoutSeconds);
       }
 
-      doRollback(considerLastMessageAsDelivered, tx);
+      doRollback(clientFailed, considerLastMessageAsDelivered, tx);
 
       if (xa)
       {
@@ -872,7 +883,7 @@
             }
             else
             {
-               doRollback(false, theTx);
+               doRollback(false, false, theTx);
             }
          }
       }
@@ -1368,7 +1379,7 @@
       }
    }
 
-   private void doRollback(final boolean lastMessageAsDelived, final Transaction theTx) throws Exception
+   private void doRollback(final boolean clientFailed, final boolean lastMessageAsDelived, final Transaction theTx) throws Exception
    {
       boolean wasStarted = started;
 
@@ -1381,7 +1392,7 @@
             consumer.setStarted(false);
          }
 
-         toCancel.addAll(consumer.cancelRefs(false, lastMessageAsDelived, theTx));
+         toCancel.addAll(consumer.cancelRefs(clientFailed, lastMessageAsDelived, theTx));
       }
 
       for (MessageReference ref : toCancel)



More information about the hornetq-commits mailing list