mirror of https://github.com/apache/activemq.git
Merge pull request #160 from emopers/SynchronizedCollection_140_422
TransportConnection does not synchronize iteration on synchronized list
This commit is contained in:
commit
07cce0609b
|
@ -892,14 +892,17 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
|
|||
}
|
||||
}
|
||||
// Cascade the connection stop to temp destinations.
|
||||
for (Iterator<DestinationInfo> iter = cs.getTempDestinations().iterator(); iter.hasNext(); ) {
|
||||
DestinationInfo di = iter.next();
|
||||
try {
|
||||
broker.removeDestination(cs.getContext(), di.getDestination(), 0);
|
||||
} catch (Throwable e) {
|
||||
SERVICELOG.warn("Failed to remove tmp destination {}", di.getDestination(), e);
|
||||
List<DestinationInfo> tempDestinations = cs.getTempDestinations();
|
||||
synchronized (tempDestinations) {
|
||||
for (Iterator<DestinationInfo> iter = tempDestinations.iterator(); iter.hasNext(); ) {
|
||||
DestinationInfo di = iter.next();
|
||||
try {
|
||||
broker.removeDestination(cs.getContext(), di.getDestination(), 0);
|
||||
} catch (Throwable e) {
|
||||
SERVICELOG.warn("Failed to remove tmp destination {}", di.getDestination(), e);
|
||||
}
|
||||
iter.remove();
|
||||
}
|
||||
iter.remove();
|
||||
}
|
||||
try {
|
||||
broker.removeConnection(cs.getContext(), cs.getInfo(), transportException.get());
|
||||
|
|
Loading…
Reference in New Issue