Package org.apache.kafka.common
Class TopicPartitionInfo
- java.lang.Object
-
- org.apache.kafka.common.TopicPartitionInfo
-
public class TopicPartitionInfo extends java.lang.Object
A class containing leadership, replicas and ISR information for a topic partition.
-
-
Constructor Summary
Constructors Constructor Description TopicPartitionInfo(int partition, Node leader, java.util.List<Node> replicas, java.util.List<Node> isr)
Create an instance of this class with the provided parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
int
hashCode()
java.util.List<Node>
isr()
Return the in-sync replicas of the partition.Node
leader()
Return the leader of the partition or null if there is none.int
partition()
Return the partition id.java.util.List<Node>
replicas()
Return the replicas of the partition in the same order as the replica assignment.java.lang.String
toString()
-
-
-
Constructor Detail
-
TopicPartitionInfo
public TopicPartitionInfo(int partition, Node leader, java.util.List<Node> replicas, java.util.List<Node> isr)
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 replicas
-
-
Method Detail
-
partition
public int partition()
Return the partition id.
-
leader
public Node leader()
Return the leader of the partition or null if there is none.
-
replicas
public java.util.List<Node> replicas()
Return the replicas of the partition in the same order as the replica assignment. The preferred replica is the head of the list. Brokers with version lower than 0.11.0.0 return the replicas in unspecified order due to a bug.
-
isr
public java.util.List<Node> isr()
Return the in-sync replicas of the partition. Note that the ordering of the result is unspecified.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-