AMQ-9159 - In topic subscriptions only remove nodes from dispatched list if

they match the destination on destination removal

(cherry picked from commit 837df23be6)
This commit is contained in:
Christopher L. Shannon (cshannon) 2022-11-10 16:06:52 -05:00
parent 3047807763
commit 8062423dcd
1 changed files with 4 additions and 3 deletions

View File

@ -357,14 +357,15 @@ public class TopicSubscription extends AbstractSubscription {
public List<MessageReference> remove(ConnectionContext context, Destination destination) throws Exception {
if (isUseTopicSubscriptionInflightStats()) {
synchronized(dispatchLock) {
for (DispatchedNode node : dispatched) {
dispatched.removeIf(node -> {
if (node.getDestination() == destination) {
//We only need to clean up inflight message size here on the sub stats as
//inflight on destination stat is cleaned up on destroy
getSubscriptionStatistics().getInflightMessageSize().addSize(-node.getSize());
return true;
}
}
dispatched.clear();
return false;
});
}
}
return super.remove(context, destination);