chia7712 commented on code in PR #20348:
URL: https://github.com/apache/kafka/pull/20348#discussion_r2291631707


##########
raft/src/main/java/org/apache/kafka/raft/LeaderAndEpoch.java:
##########
@@ -19,47 +19,15 @@
 import java.util.Objects;
 import java.util.OptionalInt;
 
-public class LeaderAndEpoch {
-    private final OptionalInt leaderId;
-    private final int epoch;
+public record LeaderAndEpoch(OptionalInt leaderId, int epoch) {
     public static final LeaderAndEpoch UNKNOWN = new 
LeaderAndEpoch(OptionalInt.empty(), 0);
 
     public LeaderAndEpoch(OptionalInt leaderId, int epoch) {

Review Comment:
   this could be simplified.
   ```java
       public LeaderAndEpoch {
           Objects.requireNonNull(leaderId);
       }
   ```
   
   Also, could you please add unit test for it?



##########
raft/src/main/java/org/apache/kafka/raft/DynamicVoter.java:
##########
@@ -118,67 +110,24 @@ public static DynamicVoter parse(String input) {
     /**
      * Create a new KIP-853 voter.
      *
-     * @param directoryId   The directory ID.
-     * @param nodeId        The voter ID.
-     * @param host          The voter hostname or IP address.
-     * @param port          The voter port.
+     * @param directoryId The directory ID.
+     * @param nodeId      The voter ID.
+     * @param host        The voter hostname or IP address.
+     * @param port        The voter port.
      */
-    public DynamicVoter(
-        Uuid directoryId,
-        int nodeId,
-        String host,
-        int port
-    ) {
-        this.directoryId = directoryId;
-        this.nodeId = nodeId;
-        this.host = host;
-        this.port = port;
-    }
-
-    public Uuid directoryId() {
-        return directoryId;
-    }
-
-    public int nodeId() {
-        return nodeId;
-    }
-
-    public String host() {
-        return host;
-    }
-
-    public int port() {
-        return port;
+    public DynamicVoter {

Review Comment:
   this default constructor is unnecessary, right?



##########
raft/src/main/java/org/apache/kafka/raft/internals/EpochElection.java:
##########
@@ -28,7 +28,7 @@
  *  Tracks the votes cast by voters in an election held by a Nominee.
  */
 public class EpochElection {

Review Comment:
   it could be a record class, right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to