MCPcopy Create free account
hub / github.com/apache/kafka / leaderFor

Method leaderFor

clients/src/main/java/org/apache/kafka/common/Cluster.java:106–112  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

readyMethod · 0.80

Calls 2

leaderMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected