in phoenix-queryserver-load-balancer/src/main/java/org/apache/phoenix/loadbalancer/service/LoadBalancer.java [112:138]
private List<HostAndPort> conductSanityCheckAndReturn() throws Exception{
if (curaFramework == null) {
throw new NullPointerException(String.valueOf(" curator framework in not initialized "));
}
if (cache == null) {
throw new NullPointerException(String.valueOf(" cache value is not initialized"));
}
boolean connected = curaFramework.getZookeeperClient().isConnected();
if (!connected) {
String message = " Zookeeper seems to be down. The data is stale ";
ConnectException exception =
new ConnectException(message);
LOG.error(message, exception);
throw exception;
}
List<String> currentNodes = curaFramework.getChildren().forPath(CONFIG.getParentPath());
List<HostAndPort> returnNodes = new ArrayList<>();
String nodeAsString = null;
for(String node:currentNodes) {
try {
returnNodes.add(HostAndPort.fromString(node));
} catch(Throwable ex) {
LOG.error(" something wrong with node string "+nodeAsString,ex);
}
}
return returnNodes;
}