AndrewJSchofield commented on code in PR #17626: URL: https://github.com/apache/kafka/pull/17626#discussion_r1824189694
########## 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: Because it matches the pattern established by `ListConsumerGroupsResult`. I went for consistency with the existing classes and methods. -- 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