git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@652438 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-05-01 06:36:20 +00:00
parent 8248314204
commit 5a27904d1d
1 changed files with 7 additions and 2 deletions

View File

@ -262,14 +262,19 @@ public abstract class AbstractRegion implements Region {
// so everything after this point would be leaked. // so everything after this point would be leaked.
// Add the subscription to all the matching queues. // Add the subscription to all the matching queues.
// But copy the matches first - to prevent deadlocks
List<Destination>addList = new ArrayList<Destination>();
synchronized(destinationsMutex) { synchronized(destinationsMutex) {
for (Iterator iter = destinationMap.get(info.getDestination()).iterator(); iter.hasNext();) { for (Iterator iter = destinationMap.get(info.getDestination()).iterator(); iter.hasNext();) {
Destination dest = (Destination)iter.next(); Destination dest = (Destination)iter.next();
dest.addSubscription(context, sub); addList.add(dest);
} }
} }
for (Destination dest:addList) {
dest.addSubscription(context, sub);
}
if (info.isBrowser()) { if (info.isBrowser()) {
((QueueBrowserSubscription)sub).destinationsAdded(); ((QueueBrowserSubscription)sub).destinationsAdded();
} }