[jboss-cvs] JBoss Messaging SVN: r1671 - in branches/Branch_1_0_1_SP/src/main/org/jboss: jms/server/endpoint messaging/core

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Dec 1 04:47:30 EST 2006


Author: timfox
Date: 2006-12-01 04:47:27 -0500 (Fri, 01 Dec 2006)
New Revision: 1671

Modified:
   branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
   branches/Branch_1_0_1_SP/src/main/org/jboss/messaging/core/ChannelSupport.java
Log:
More tweaks



Modified: branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
===================================================================
--- branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java	2006-12-01 00:57:42 UTC (rev 1670)
+++ branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java	2006-12-01 09:47:27 UTC (rev 1671)
@@ -904,15 +904,26 @@
       public synchronized void afterCommit(boolean onePhase) throws TransactionException
       {
          // Remove the deliveries from the delivery map.
-         Iterator iter = delList.iterator();
-         while (iter.hasNext())
+         
+         synchronized (lock)
          {
-            Long messageID = (Long)iter.next();
-
-            if (deliveries.remove(messageID) == null)
+            if (closed)
             {
-               throw new TransactionException("Failed to remove delivery " + messageID);
+               //We must throw an exception to the client otherwise they may think the commit has succeeded
+               //This can happen if the connection is closed by another thread - e.g. the leasePinger
+               throw new TransactionException("Failed to acknowledge message, session has been closed");
             }
+            
+            Iterator iter = delList.iterator();
+            while (iter.hasNext())
+            {
+               Long messageID = (Long)iter.next();
+   
+               if (deliveries.remove(messageID) == null)
+               {
+                  throw new TransactionException("Failed to remove delivery " + messageID);
+               }
+            }
          }
       }
 

Modified: branches/Branch_1_0_1_SP/src/main/org/jboss/messaging/core/ChannelSupport.java
===================================================================
--- branches/Branch_1_0_1_SP/src/main/org/jboss/messaging/core/ChannelSupport.java	2006-12-01 00:57:42 UTC (rev 1670)
+++ branches/Branch_1_0_1_SP/src/main/org/jboss/messaging/core/ChannelSupport.java	2006-12-01 09:47:27 UTC (rev 1671)
@@ -753,7 +753,7 @@
 
                            iter = messageRefs.iterator();
 
-                           //And skip the next one (that's the one we just added back)
+                           //And skip the first one (that's the one we just added back)
 
                            iter.next();
                         }




More information about the jboss-cvs-commits mailing list