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

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

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


##########
activemq-broker/src/main/java/org/apache/activemq/broker/region/BaseDestination.java:
##########
@@ -311,12 +313,27 @@ public final MessageStore getMessageStore() {
 
     @Override
     public boolean isActive() {
-        boolean isActive = destinationStatistics.getConsumers().getCount() > 0 
||
-                           destinationStatistics.getProducers().getCount() > 0;
-        if (isActive && isGcWithNetworkConsumers() && 
destinationStatistics.getConsumers().getCount() > 0) {
-            isActive = hasRegularConsumers(getConsumers());
+        if (destinationStatistics.getProducers().getCount() > 0) {
+            return true;
         }
-        return isActive;
+
+        var destinationActive = true;
+        if (destinationStatistics.getConsumers().getCount() > 0) {
+            Predicate<Subscription> isActiveConsumer = subscription -> {

Review Comment:
   Previously we didn't have to filter if the isGcWithNetworkConsumers() flag 
was false. We could simply just look for the count of consumers and if greater 
than 0 return. There was no iterating.
   
   Now we always have to iterate, and on top of that java streams is slow and 
this is somewhat on a hot path because it's going to be called frequently 
depending on the setup. I really like streams but not if there's potential 
performance issues if someone is tuning frequent checks for active consumers 
and has a lot of consumers.
   
   I would prefer if this:
   1. Preserved avoiding iterating if the two flags are both false
   2. Just used a for each loop and avoid streams for performance.





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

    Worklog Id:     (was: 1001040)
    Time Spent: 1h  (was: 50m)

> 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: 1h
>  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