[jboss-cvs] JBoss Messaging SVN: r1665 - branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/endpoint

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 30 12:56:09 EST 2006


Author: ovidiu.feodorov at jboss.com
Date: 2006-11-30 12:56:08 -0500 (Thu, 30 Nov 2006)
New Revision: 1665

Modified:
   branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
Log:
averted deadlock as described by http://jira.jboss.com/jira/browse/JBMESSAGING-660

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-11-30 17:39:53 UTC (rev 1664)
+++ branches/Branch_1_0_1_SP/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java	2006-11-30 17:56:08 UTC (rev 1665)
@@ -690,22 +690,28 @@
       //So we need to cancel these
             
       if (!toDeliver.isEmpty())
-      { 
+      {
+         // this is to avoid the deadlock described in http://jira.jboss.com/jira/browse/JBMESSAGING-660
+         List toDeliverCopy = new ArrayList(toDeliver.size());
          synchronized (lock)
          {
             for (int i = toDeliver.size() - 1; i >= 0; i--)
             {
-               MessageProxy proxy = (MessageProxy)toDeliver.get(i);
-               
-               long id = proxy.getMessage().getMessageID();
-               
-               cancelDelivery(new Long(id), proxy.getMessage().getDeliveryCount());
+               toDeliverCopy.add(toDeliver.get(i));
             }
+
+            toDeliver.clear();
          }
-                 
-         toDeliver.clear();
-         
+
+         for(Iterator i = toDeliverCopy.iterator(); i.hasNext();)
+         {
+            MessageProxy proxy = (MessageProxy)i.next();
+            long id = proxy.getMessage().getMessageID();
+            cancelDelivery(new Long(id), proxy.getMessage().getDeliveryCount());
+         }
+
          bufferFull = false;
+
       }      
    }
       




More information about the jboss-cvs-commits mailing list