Class TopicPartitionInfo

java.lang.Object
org.apache.kafka.common.TopicPartitionInfo

public class TopicPartitionInfo extends Object
A class containing leadership, replicas and ISR information for a topic partition.
  • Constructor Details

    • TopicPartitionInfo

      public TopicPartitionInfo(int partition, Node leader, List<Node> replicas, List<Node> isr, List<Node> elr, List<Node> lastKnownElr)
      Create an instance of this class with the provided parameters.
      Parameters:
      partition - the partition id
      leader - the leader of the partition or Node.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
      elr - the eligible leader replicas
      lastKnownElr - the last known eligible leader replicas.
    • TopicPartitionInfo

      public TopicPartitionInfo(int partition, Node leader, List<Node> replicas, List<Node> isr)
  • Method Details

    • 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 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 List<Node> isr()
      Return the in-sync replicas of the partition. Note that the ordering of the result is unspecified.
    • elr

      public List<Node> elr()
      Return the eligible leader replicas of the partition. Note that the ordering of the result is unspecified.
    • lastKnownElr

      public List<Node> lastKnownElr()
      Return the last known eligible leader replicas of the partition. Note that the ordering of the result is unspecified.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object