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.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
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