You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cs...@apache.org on 2022/11/10 21:18:58 UTC

[activemq] branch activemq-5.17.x updated: AMQ-9159 - In topic subscriptions only remove nodes from dispatched list if they match the destination on destination removal

This is an automated email from the ASF dual-hosted git repository.

cshannon pushed a commit to branch activemq-5.17.x
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/activemq-5.17.x by this push:
     new 8062423dc AMQ-9159 - In topic subscriptions only remove nodes from dispatched list if they match the destination on destination removal
8062423dc is described below

commit 8062423dcdc11260347cb797a98f719de2dac7bd
Author: Christopher L. Shannon (cshannon) <ch...@gmail.com>
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
    
    (cherry picked from commit 837df23be66f9d22e4df61ae40cd70de34e064a7)
---
 .../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 0e13dd2db..412ab43df 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);