activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r652438 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
Date Thu, 01 May 2008 06:36:20 GMT
Author: rajdavies
Date: Wed Apr 30 23:36:20 2008
New Revision: 652438

URL: http://svn.apache.org/viewvc?rev=652438&view=rev
Log:
Fix for https://issues.apache.org/activemq/browse/AMQ-1705

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java?rev=652438&r1=652437&r2=652438&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
Wed Apr 30 23:36:20 2008
@@ -262,13 +262,18 @@
             // so everything after this point would be leaked.
 
             // Add the subscription to all the matching queues.
-            
+            // But copy the matches first - to prevent deadlocks
+            List<Destination>addList = new ArrayList<Destination>();
             synchronized(destinationsMutex) {
                 for (Iterator iter = destinationMap.get(info.getDestination()).iterator();
iter.hasNext();) {
                     Destination dest = (Destination)iter.next();
-                    dest.addSubscription(context, sub);
+                    addList.add(dest);
                 }
             }
+            
+            for (Destination dest:addList) {
+                dest.addSubscription(context, sub);
+            }
 
             if (info.isBrowser()) {
                 ((QueueBrowserSubscription)sub).destinationsAdded();



Mime
View raw message