Merge pull request #160 from emopers/SynchronizedCollection_140_422

TransportConnection does not synchronize iteration on synchronized list
This commit is contained in:
JB Onofré 2023-10-17 11:21:36 +02:00 committed by GitHub
commit 07cce0609b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 7 deletions

View File

@ -892,7 +892,9 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
}
}
// Cascade the connection stop to temp destinations.
for (Iterator<DestinationInfo> iter = cs.getTempDestinations().iterator(); iter.hasNext(); ) {
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);
@ -901,6 +903,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
}
iter.remove();
}
}
try {
broker.removeConnection(cs.getContext(), cs.getInfo(), transportException.get());
} catch (Throwable e) {