本文整理汇总了Java中org.apache.solr.common.cloud.ZkStateReader.getLeaderRetry方法的典型用法代码示例。如果您正苦于以下问题:Java ZkStateReader.getLeaderRetry方法的具体用法?Java ZkStateReader.getLeaderRetry怎么用?Java ZkStateReader.getLeaderRetry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.common.cloud.ZkStateReader
的用法示例。
在下文中一共展示了ZkStateReader.getLeaderRetry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createServers
import org.apache.solr.common.cloud.ZkStateReader; //导入方法依赖的package包/类
@Override
protected void createServers(int numShards) throws Exception {
// give everyone there own solrhome
File controlHome = new File(new File(getSolrHome()).getParentFile(), "control" + homeCount.incrementAndGet());
FileUtils.copyDirectory(new File(getSolrHome()), controlHome);
setupJettySolrHome(controlHome);
System.setProperty("collection", "control_collection");
String numShardsS = System.getProperty(ZkStateReader.NUM_SHARDS_PROP);
System.setProperty(ZkStateReader.NUM_SHARDS_PROP, "1");
controlJetty = createJetty(controlHome, null); // let the shardId default to shard1
System.clearProperty("collection");
if(numShardsS != null) {
System.setProperty(ZkStateReader.NUM_SHARDS_PROP, numShardsS);
} else {
System.clearProperty(ZkStateReader.NUM_SHARDS_PROP);
}
controlClient = createNewSolrServer(controlJetty.getLocalPort());
StringBuilder sb = new StringBuilder();
for (int i = 1; i <= numShards; i++) {
if (sb.length() > 0) sb.append(',');
// give everyone there own solrhome
File jettyHome = new File(new File(getSolrHome()).getParentFile(), "jetty" + homeCount.incrementAndGet());
setupJettySolrHome(jettyHome);
JettySolrRunner j = createJetty(jettyHome, null, "shard" + (i + 2));
jettys.add(j);
clients.add(createNewSolrServer(j.getLocalPort()));
sb.append(buildUrl(j.getLocalPort()));
}
shards = sb.toString();
// now wait till we see the leader for each shard
for (int i = 1; i <= numShards; i++) {
ZkStateReader zkStateReader = ((SolrDispatchFilter) jettys.get(0)
.getDispatchFilter().getFilter()).getCores().getZkController()
.getZkStateReader();
zkStateReader.getLeaderRetry("collection1", "shard" + (i + 2), 15000);
}
}