dajac commented on code in PR #15196:
URL: https://github.com/apache/kafka/pull/15196#discussion_r1467661730


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorService.java:
##########
@@ -524,37 +495,39 @@ public CompletableFuture<ListGroupsResponseData> 
listGroups(
             );
         }
 
-        final CompletableFuture<ListGroupsResponseData> future = new 
CompletableFuture<>();
-        final List<ListGroupsResponseData.ListedGroup> results = new 
ArrayList<>();
         final Set<TopicPartition> existingPartitionSet = runtime.partitions();
-        final AtomicInteger cnt = new 
AtomicInteger(existingPartitionSet.size());
 
         if (existingPartitionSet.isEmpty()) {
             return CompletableFuture.completedFuture(new 
ListGroupsResponseData());
         }
 
+        final 
List<CompletableFuture<List<ListGroupsResponseData.ListedGroup>>> futures =
+            new ArrayList<>();
+
         for (TopicPartition tp : existingPartitionSet) {
-            runtime.scheduleReadOperation(
+            futures.add(runtime.scheduleReadOperation(
                 "list-groups",
                 tp,
                 (coordinator, lastCommittedOffset) -> 
coordinator.listGroups(request.statesFilter(), lastCommittedOffset)
-            ).handle((groups, exception) -> {
-                if (exception == null) {
-                    synchronized (results) {
-                        results.addAll(groups);
-                    }
+            ).exceptionally(exception -> {
+                exception = Errors.maybeUnwrapException(exception);

Review Comment:
   The handling was actually correct here. However, I discovered recently that 
the `exception` could be wrapped in some case so I got a bit paranoiac and 
unwrap everywhere.



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to