sarathsubramanian commented on a change in pull request #118:
URL: https://github.com/apache/atlas/pull/118#discussion_r564562125
##########
File path: common/src/main/java/org/apache/atlas/utils/KafkaUtils.java
##########
@@ -126,15 +126,7 @@ public Integer getPartitionCount(String topicName) throws
ExecutionException, In
LOG.debug("==> KafkaUtils.getPartitionCount({})", topicName);
}
- Integer partitionCount = null;
- DescribeTopicsResult describeTopicsResult =
adminClient.describeTopics(Collections.singleton(topicName));
- Map<String, KafkaFuture<TopicDescription>> futureMap =
describeTopicsResult.values();
- for(Map.Entry<String, KafkaFuture<TopicDescription>> futureEntry :
futureMap.entrySet()) {
- KafkaFuture<TopicDescription> topicDescriptionFuture =
futureEntry.getValue();
- TopicDescription topicDescription = topicDescriptionFuture.get();
- List<TopicPartitionInfo> partitionList =
topicDescription.partitions();
- partitionCount = partitionList.size();
- }
+ Integer partitionCount = getPartitionList(topicName).size();
Review comment:
getPartitionList(topicName) can possibly return null. consider adding
null check
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]