You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/04/04 13:03:41 UTC

[GitHub] [rocketmq] dugenkui03 commented on a diff in pull request #4115: [ISSUE #4114] Add threadPool in DefaultMQAdminExtImpl and execute queryConsumeTimeSpan concurrently

dugenkui03 commented on code in PR #4115:
URL: https://github.com/apache/rocketmq/pull/4115#discussion_r841713464


##########
tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:
##########
@@ -694,12 +708,28 @@ public GroupList queryTopicConsumeByWho(
         RemotingException, MQClientException {
         List<QueueTimeSpan> spanSet = new ArrayList<QueueTimeSpan>();
         TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
-        for (BrokerData bd : topicRouteData.getBrokerDatas()) {
-            String addr = bd.selectBrokerAddr();
-            if (addr != null) {
-                spanSet.addAll(this.mqClientInstance.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, group, timeoutMillis));
-            }
-        }
+
+        Function<BrokerData, CompletableFuture<List<QueueTimeSpan>>> func = bd -> {
+            CompletableFuture<List<QueueTimeSpan>> future = new CompletableFuture<>();
+            executors.submit(() -> {
+                try {
+                    String addr = bd.selectBrokerAddr();
+                    if (addr != null) {

Review Comment:
   If `if (addr != null)` result in `true`, then a `future` which will never complete will return.



-- 
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: dev-unsubscribe@rocketmq.apache.org

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