aloknnikhil commented on a change in pull request #9985:
URL: https://github.com/apache/kafka/pull/9985#discussion_r566313405



##########
File path: raft/src/main/java/org/apache/kafka/raft/RaftConfig.java
##########
@@ -76,7 +87,48 @@
     private final int electionBackoffMaxMs;
     private final int fetchTimeoutMs;
     private final int appendLingerMs;
-    private final Map<Integer, InetSocketAddress> voterConnections;
+    private final Map<Integer, AddressSpec> voterConnections;
+
+    public static abstract class AddressSpec {
+       public abstract InetSocketAddress address();
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+
+            if (obj == null || getClass() != obj.getClass()) {
+                return false;
+            }
+
+            final AddressSpec that = (AddressSpec) obj;
+            return that.address().equals(address());
+        }
+    }
+
+    public static class InetAddressSpec extends AddressSpec {
+        private final InetSocketAddress address;
+
+        public InetAddressSpec(InetSocketAddress address) {
+            if (address.equals(UNROUTABLE_ADDRESS)) {
+                throw new IllegalArgumentException("Address not routable");
+            }
+            this.address = address;
+        }
+
+        @Override
+        public InetSocketAddress address() {
+            return address;
+        }
+    }
+
+    public static class UnknownAddressSpec extends AddressSpec {

Review comment:
       Ack. Refactored as stated above.




----------------------------------------------------------------
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.

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


Reply via email to