chia7712 commented on code in PR #17626: URL: https://github.com/apache/kafka/pull/17626#discussion_r1823805661
########## clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java: ########## @@ -3490,6 +3490,138 @@ void handleFailure(Throwable throwable) { return new DescribeDelegationTokenResult(tokensFuture); } + private static final class ListGroupsResults { + private final List<Throwable> errors; + private final HashMap<String, GroupListing> listings; + private final HashSet<Node> remaining; + private final KafkaFutureImpl<Collection<Object>> future; + + ListGroupsResults(Collection<Node> leaders, + KafkaFutureImpl<Collection<Object>> future) { + this.errors = new ArrayList<>(); + this.listings = new HashMap<>(); + this.remaining = new HashSet<>(leaders); + this.future = future; + tryComplete(); + } + + synchronized void addError(Throwable throwable, Node node) { + ApiError error = ApiError.fromThrowable(throwable); + if (error.message() == null || error.message().isEmpty()) { + errors.add(error.error().exception("Error listing groups on " + node)); + } else { + errors.add(error.error().exception("Error listing groups on " + node + ": " + error.message())); + } + } + + synchronized void addListing(GroupListing listing) { + listings.put(listing.groupId(), listing); Review Comment: > I suppose there is a small possibility that more than one node responds for a particular group due to timing effects, That makes sense. for another, why does `ListGroupsResult` not use `map` structure? -- 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