You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by fpj <gi...@git.apache.org> on 2018/05/07 21:16:34 UTC
[GitHub] zookeeper pull request #451: ZOOKEEPER-2184: Zookeeper Client should re-reso...
Github user fpj commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/451#discussion_r186553004
--- Diff: src/java/main/org/apache/zookeeper/client/StaticHostProvider.java ---
@@ -111,9 +154,18 @@ public InetSocketAddress next(long spinDelay) {
lastIndex = 0;
}
- return serverAddresses.get(currentIndex);
+ InetSocketAddress curAddr = serverAddresses.get(currentIndex);
+
+ String curHostString = getHostString(curAddr);
+ List<InetAddress> resolvedAddresses = new ArrayList<InetAddress>(Arrays.asList(this.resolver.getAllByName(curHostString)));
+ if (resolvedAddresses.isEmpty()) {
+ throw new UnknownHostException("No IP address returned for address: " + curHostString);
--- End diff --
Should we try with the next on the list rather than throwing? After all, the call is to get the "next" resolved address. Of course, it is possible that we go through the whole list an find nothing. We might want to throw then so that we don't loop forever.
---