Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Remove Map from ElectPreferredLeadersResult

...

Code Block
/**
 * Elect the preferred replica of the given {@code partitions} as leader, or
 * elect the preferred replica for all partitions as leader if the argument to {@code partitions} is null.
 *
 * This operation is supported by brokers with version 1.0 or higher.
 */
ElectPreferredLeadersResult electPreferredLeaders(Collection<TopicPartition> partitions, ElectPreferredLeadersOptions options)
ElectPreferredLeadersResult electPreferredLeaders(Collection<TopicPartition> partitions)

Where

Code Block
public class ElectPreferredLeadersOptions {
    public ElectPreferredLeadersOptions() { ... }
    /**
     * The request timeout in milliseconds for this operation or {@code null} if the default request timeout for the
     * AdminClient should be used.
     */
    public Integer timeoutMs() { ... }
    /**
     * Set the request timeout in milliseconds for this operation or {@code null} if the default request timeout for the
     * AdminClient should be used.
     */
    public ElectPreferredLeadersOptions timeoutMs(Integer timeoutMs) { ... }
}
public class ElectPreferredLeadersResult {
    // package access constructor

    /**
     * Get the result of the election for the given TopicPartition.
     * If there was not an   Map<TopicPartition, KafkaFuture<Void>> values(election triggered for the given TopicPartition, the
     * returned future will complete with an error.
     */
    public KafkaFuture<Void> partitionResult(TopicPartition partition) { ... }
    KafkaFuture<Void>

    /**
     * <p>Get the topic partitions for which a leader election was attempted.
     * The presence of a topic partition in the Collection obtained from 
     * the returned future does not indicate the election was successful: 
     * A partition will appear in this result if an election was attempted
     * even if the election was not successful.</p>
     *
     * <p>This method is provided to discover the partitions when
     * {@link AdminClient#electPreferredLeaders(Collection)} is called 
     * with a null {@code partitions} argument.</p>
     */
    public KafkaFuture<Collection<TopicPartition>> partitions();

    KafkaFuture<Void> all() { ... }
 }

A call to electPreferredLeaders() will send a ElectPreferredLeadersRequest to the controller broker.

...