本文整理汇总了Java中org.apache.solr.core.CoreContainer.isZooKeeperAware方法的典型用法代码示例。如果您正苦于以下问题:Java CoreContainer.isZooKeeperAware方法的具体用法?Java CoreContainer.isZooKeeperAware怎么用?Java CoreContainer.isZooKeeperAware使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.core.CoreContainer
的用法示例。
在下文中一共展示了CoreContainer.isZooKeeperAware方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAndPrepShardHandler
import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
private ShardHandler getAndPrepShardHandler(SolrQueryRequest req, ResponseBuilder rb, ShardHandlerFactory shardHandlerFactory) {
ShardHandler shardHandler = null;
boolean isZkAware = false;
CoreContainer cc = null;
if (req.getCore() != null) {
cc = req.getCore().getCoreContainer();
isZkAware = cc.isZooKeeperAware();
}
rb.isDistrib = req.getParams().getBool("distrib", isZkAware);
if (!rb.isDistrib) {
// for back compat, a shards param with URLs like localhost:8983/solr will mean that this
// search is distributed.
final String shards = req.getParams().get(ShardParams.SHARDS);
rb.isDistrib = ((shards != null) && (shards.indexOf('/') > 0));
}
if (rb.isDistrib) {
shardHandler = shardHandlerFactory.getShardHandler();
shardHandler.prepDistributed(rb);
if (!rb.isDistrib) {
shardHandler = null; // request is not distributed after all and so the shard handler is not needed
}
}
if(isZkAware) {
ZkController zkController = cc.getZkController();
NamedList<Object> headers = rb.rsp.getResponseHeader();
if(headers != null) {
headers.add("zkConnected",
zkController != null
? !zkController.getZkClient().getConnectionManager().isLikelyExpired()
: false);
}
}
return shardHandler;
}
示例2: handleRequestBody
import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp)
throws InterruptedException, KeeperException, IOException {
CoreContainer coreContainer = req.getCore().getCoreDescriptor().getCoreContainer();
if (coreContainer.isZooKeeperAware()) {
showFromZooKeeper(req, rsp, coreContainer);
} else {
showFromFileSystem(req, rsp);
}
}
示例3: getZkClient
import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
public SolrZkClient getZkClient() {
SolrZkClient client = null;
if(getCore() != null) {
CoreContainer container = getCore().getCoreDescriptor().getCoreContainer();
if(container.isZooKeeperAware()) {
client = container.getZkController().getZkClient();
}
}
return client;
}
示例4: handleRequestBody
import org.apache.solr.core.CoreContainer; //导入方法依赖的package包/类
@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws IOException, KeeperException, InterruptedException
{
CoreContainer coreContainer = req.getCore().getCoreDescriptor().getCoreContainer();
if (coreContainer.isZooKeeperAware()) {
showFromZooKeeper(req, rsp, coreContainer);
} else {
showFromFileSystem(req, rsp);
}
}