bob-barrett commented on a change in pull request #9902:
URL: https://github.com/apache/kafka/pull/9902#discussion_r567120007



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/ClusterConnectionStates.java
##########
@@ -183,6 +186,10 @@ public void disconnected(String id, long now) {
             connectingNodes.remove(id);
         } else {
             resetConnectionSetupTimeout(nodeState);
+            if (nodeState.state.isConnected()) {
+                // If a connection had previously been established, re-resolve 
DNS because the IPs may have changed
+                nodeState.addresses = Collections.emptyList();

Review comment:
       Accessing the field is allowed, but I think @mimaison meant that it 
makes the code a little confusing and inconsistent. `NodeConnectionState` has 
some private fields and some package-private ones, and `addresses` previous was 
only modified by methods on `NodeConnectionState`, not accessed directly by the 
top-level class. I've moved the empty list assignment into a 
`NodeConnectionState.clearAddresses` method
   
   Agree about the comment, I've updated it




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