This is an automated email from the ASF dual-hosted git repository.
cshannon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq.git
The following commit(s) were added to refs/heads/main by this push:
new 837df23be AMQ-9159 - In topic subscriptions only remove nodes from
dispatched list if they match the destination on destination removal
837df23be is described below
commit 837df23be66f9d22e4df61ae40cd70de34e064a7
Author: Christopher L. Shannon (cshannon) <[email protected]>
AuthorDate: Thu Nov 10 16:06:52 2022 -0500
AMQ-9159 - In topic subscriptions only remove nodes from dispatched list if
they match the destination on destination removal
---
.../java/org/apache/activemq/broker/region/TopicSubscription.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git
a/activemq-broker/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java
index 050bb9aa2..73b6017c4 100644
---
a/activemq-broker/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java
+++
b/activemq-broker/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java
@@ -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);