Github user lvfangmin commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/534#discussion_r194215559
--- Diff: src/java/main/org/apache/zookeeper/client/StaticHostProvider.java
---
@@ -149,15 +185,12 @@ public
StaticHostProvider(Collection<InetSocketAddress> serverAddresses,
* @param currentHost the host to which this client is currently
connected
* @return true if changing connections is necessary for
load-balancing, false otherwise
*/
-
-
@Override
public synchronized boolean updateServerList(
Collection<InetSocketAddress> serverAddresses,
InetSocketAddress currentHost) {
- // Resolve server addresses and shuffle them
- List<InetSocketAddress> resolvedList =
resolveAndShuffle(serverAddresses);
- if (resolvedList.isEmpty()) {
+ List<InetSocketAddress> shuffledList = shuffle(serverAddresses);
--- End diff --
After this change, the old / new server list both contains unresolved
address, so it's comparable, but it's meaningless to compare addr.getAddress
because it will return null when it's unresolved.
---