Class TopicPartitionInfo
java.lang.Object
org.apache.kafka.common.TopicPartitionInfo
A class containing leadership, replicas and ISR information for a topic partition.
Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionelr()Return the eligible leader replicas of the partition.booleaninthashCode()isr()Return the in-sync replicas of the partition.Return the last known eligible leader replicas of the partition.leader()Return the leader of the partition or null if there is none.Return the observer replicas of the partition.static TopicPartitionInfoofReplicasAndObservers(int partition, Node leader, List<Node> replicas, List<Node> observers, List<Node> isr) intReturn the partition id.replicas()Return the replicas of the partition in the same order as the replica assignment.toString()
Constructor Details
TopicPartitionInfo
public TopicPartitionInfo(int partition, Node leader, List<Node> replicas, List<Node> isr, List<Node> elr, List<Node> lastKnownElr, List<Node> observers) Create an instance of this class with the provided parameters.- Parameters:
partition- the partition idleader- the leader of the partition orNode.noNode()if there is none.replicas- the replicas of the partition in the same order as the replica assignment (the preferred replica is the head of the list)isr- the in-sync replicaselr- the eligible leader replicaslastKnownElr- the last known eligible leader replicas.observers- The observer replicas.
TopicPartitionInfo
Method Details
ofReplicasAndObservers
@Confluentpublic static TopicPartitionInfo ofReplicasAndObservers(int partition, Node leader, List<Node> replicas, List<Node> observers, List<Node> isr) partition
public int partition()Return the partition id.leader
Return the leader of the partition or null if there is none.replicas
observers
Return the observer replicas of the partition. Observers are not part of ISR and cannot be elected as leader.isr
elr
lastKnownElr
toString
equals
hashCode