SOLR-9784: Refactor CloudSolrClient to eliminate direct dependency on ZK

This commit is contained in:
Noble Paul 2016-11-25 01:10:14 +05:30
parent e309f90589
commit 8201ddc3b3
1 changed files with 2 additions and 6 deletions

View File

@ -1230,7 +1230,7 @@ public class CloudSolrClient extends SolrClient {
}
List<String> theUrlList = new ArrayList<>();
if (ADMIN_PATHS.contains(request.getPath())) {
Set<String> liveNodes = getLiveNodes();
Set<String> liveNodes = stateProvider.liveNodes();
for (String liveNode : liveNodes) {
theUrlList.add(ZkStateReader.getBaseUrlForNodeName(liveNode,
(String) stateProvider.getClusterProperties().getOrDefault(ZkStateReader.URL_SCHEME,"http")));
@ -1263,7 +1263,7 @@ public class CloudSolrClient extends SolrClient {
Collection<Slice> routeSlices = col.getRouter().getSearchSlices(shardKeys, reqParams , col);
ClientUtils.addSlices(slices, collectionName, routeSlices, true);
}
Set<String> liveNodes = getLiveNodes();
Set<String> liveNodes = stateProvider.liveNodes();
List<String> leaderUrlList = null;
List<String> urlList = null;
@ -1339,10 +1339,6 @@ public class CloudSolrClient extends SolrClient {
return rsp.getResponse();
}
private Set<String> getLiveNodes() {
return getZkStateReader().getClusterState().getLiveNodes();
}
Set<String> getCollectionNames(String collection) {
// Extract each comma separated collection name and store in a List.
List<String> rawCollectionsList = StrUtils.splitSmart(collection, ",", true);