[ 
https://issues.apache.org/jira/browse/AMQ-9692?focusedWorklogId=1001805&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1001805
 ]

ASF GitHub Bot logged work on AMQ-9692:
---------------------------------------

                Author: ASF GitHub Bot
            Created on: 26/Jan/26 14:11
            Start Date: 26/Jan/26 14:11
    Worklog Time Spent: 10m 
      Work Description: cshannon commented on code in PR #1484:
URL: https://github.com/apache/activemq/pull/1484#discussion_r2727739331


##########
activemq-broker/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java:
##########
@@ -260,16 +260,21 @@ protected List<Subscription> 
addSubscriptionsForDestination(ConnectionContext co
     }
 
     @Override
-    public void removeDestination(ConnectionContext context, 
ActiveMQDestination destination, long timeout)
-            throws Exception {
-
+    public void removeDestination(ConnectionContext context, 
ActiveMQDestination destination, long timeout) throws Exception {
         // No timeout.. then try to shut down right way, fails if there are
         // current subscribers.
         if (timeout == 0) {
             for (Iterator<Subscription> iter = 
subscriptions.values().iterator(); iter.hasNext();) {
                 Subscription sub = iter.next();
                 if (sub.matches(destination) ) {
-                    throw new JMSException("Destination: " + destination + " 
still has an active subscription: " + sub);
+                    if(sub.isWildcard()) {
+                        var dest = destinations.get(destination);
+                        if(dest != null && 
dest.isGcWithOnlyWildcardConsumers()) {

Review Comment:
   There still seems to be a missing test case because this logic is broken, 
Intellij flagged it. This continue does nothing as it's in a loop and this will 
not throw the exception is isGcWithOnlyWildcardConsumers() is false.
   
   This should likely just be rewritten as something like and include a test 
that would catch a similar mistake int he future.
   
   ```java
   if (sub.matches(destination) ) {
       var dest = destinations.get(destination);
       if(!sub.isWildcard() || dest == null || 
!dest.isGcWithOnlyWildcardConsumers()) {
           throw new JMSException("Destination: " + destination + " still has 
an active subscription: " + sub);
       } 
   }
   ```





Issue Time Tracking
-------------------

    Worklog Id:     (was: 1001805)
    Time Spent: 2h 20m  (was: 2h 10m)

> Support destination gc sweep of destinations with wild card consumers
> ---------------------------------------------------------------------
>
>                 Key: AMQ-9692
>                 URL: https://issues.apache.org/jira/browse/AMQ-9692
>             Project: ActiveMQ
>          Issue Type: Improvement
>            Reporter: Matt Pavlovich
>            Assignee: Matt Pavlovich
>            Priority: Minor
>             Fix For: 6.3.0, 5.19.2
>
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> Currently, a wild-card consumer can hold up a destination from being 
> automatically garbage collected. This change would add a policyEntry setting 
> to allow garbage collection if the destination only has wild card consumers



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to