mumrah commented on code in PR #15470:
URL: https://github.com/apache/kafka/pull/15470#discussion_r1544478846
##########
clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java:
##########
@@ -2185,9 +2184,155 @@ void handleFailure(Throwable throwable) {
completeAllExceptionally(topicFutures.values(), throwable);
}
};
- if (!topicNamesList.isEmpty()) {
- runnable.call(call, now);
+ }
+
+ Call generateDescribeTopicsCallWithDescribeTopicPartitionsApi(
+ List<String> topicNamesList,
+ Map<String, KafkaFutureImpl<TopicDescription>> topicFutures,
+ Map<Integer, Node> nodes,
+ DescribeTopicsOptions options,
+ long now
+ ) {
+ return new Call("describeTopicPartitions", calcDeadlineMs(now,
options.timeoutMs()),
+ new LeastLoadedNodeProvider()) {
+ Map<String, TopicRequest> pendingTopics =
+ topicNamesList.stream().map(topicName -> new
TopicRequest().setName(topicName))
+ .collect(Collectors.toMap(topicRequest ->
topicRequest.name(), topicRequest -> topicRequest, (t1, t2) -> t1,
TreeMap::new));
Review Comment:
I think this would be more readable if we just create a TreeMap and populate
it in a for loop. Since we are using this map like a queue, it might be better
to use LinkedHashMap (after sorting the topics). Really, we don't even need a
map since we can build the TopicRequest-s on demand in createRequest.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]