kenliao94 commented on code in PR #1288:
URL: https://github.com/apache/activemq/pull/1288#discussion_r1760617329


##########
activemq-broker/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java:
##########
@@ -280,11 +280,21 @@ public ObjectName[] getTopics() {
         return safeGetBroker().getTopicsNonSuppressed();
     }
 
+    @Override
+    public int getTotalTopicsCount() {
+        return getTopics().length;
+    }
+
     @Override
     public ObjectName[] getQueues() {
         return safeGetBroker().getQueuesNonSuppressed();
     }
 
+    @Override
+    public int getTotalQueuesCount() {
+        return getQueues().length;

Review Comment:
   Good callout, I believe the new array of objects you are referring to is the 
one created in `onlyNonSuppressed`  which copy over the non suppressed queues 
or topics already maintained in the `ManagedRegionBroker`.  Are you saying I 
should just simply return the size of `private final Map<ObjectName, 
DestinationView> queues = new ConcurrentHashMap<>();` in `ManagedRegionBroker`?
   
   My concern is that it will not agree with the queue or topic list in the 
`queues` and `topics` MBean attribute, and those are non suppressed which 
should be the correct list.
   
   The optimization done at this PR is mainly for user application. Because 
they will need to read that ObjectName array into their memory space even all 
they need is the count of `queues` or `topics`. So if this PR is merged as it 
is, the user application memory space will not be bloated (even tho as your 
pointed out, on the broker side, it will still need to create an array of those 
objects on the broker process memory space).
   
   WDYT?



-- 
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: gitbox-unsubscr...@activemq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org
For additional commands, e-mail: gitbox-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to