Get the current leader for the given topic-partition @param topicPartition The topic and partition we want to know the leader for @return The node that is the leader for this topic-partition, or null if there is currently no leader
(TopicPartition topicPartition)
| 104 | * @return The node that is the leader for this topic-partition, or null if there is currently no leader |
| 105 | */ |
| 106 | public Node leaderFor(TopicPartition topicPartition) { |
| 107 | PartitionInfo info = partitionsByTopicPartition.get(topicPartition); |
| 108 | if (info == null) |
| 109 | return null; |
| 110 | else |
| 111 | return info.leader(); |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Get the metadata for the specified partition |