当前位置: 首页>>代码示例>>Java>>正文


Java IndexService.hasShard方法代码示例

本文整理汇总了Java中org.elasticsearch.index.IndexService.hasShard方法的典型用法代码示例。如果您正苦于以下问题:Java IndexService.hasShard方法的具体用法?Java IndexService.hasShard怎么用?Java IndexService.hasShard使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.index.IndexService的用法示例。


在下文中一共展示了IndexService.hasShard方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: nodeOperation

import org.elasticsearch.index.IndexService; //导入方法依赖的package包/类
@Override
protected NodeStoreFilesMetaData nodeOperation(NodeRequest request) {
    if (request.unallocated) {
        IndexService indexService = indicesService.indexService(request.shardId.index().name());
        if (indexService == null) {
            return new NodeStoreFilesMetaData(clusterService.localNode(), null);
        }
        if (!indexService.hasShard(request.shardId.id())) {
            return new NodeStoreFilesMetaData(clusterService.localNode(), null);
        }
    }
    IndexMetaData metaData = clusterService.state().metaData().index(request.shardId.index().name());
    if (metaData == null) {
        return new NodeStoreFilesMetaData(clusterService.localNode(), null);
    }
    try {
        return new NodeStoreFilesMetaData(clusterService.localNode(), listStoreMetaData(request.shardId));
    } catch (IOException e) {
        throw new ElasticsearchException("Failed to list store metadata for shard [" + request.shardId + "]", e);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:22,代码来源:TransportNodesListShardStoreMetaData.java

示例2: failAndRemoveShard

import org.elasticsearch.index.IndexService; //导入方法依赖的package包/类
private void failAndRemoveShard(ShardRouting shardRouting, IndexService indexService, boolean sendShardFailure, String message, @Nullable Throwable failure) {
    if (indexService.hasShard(shardRouting.getId())) {
        try {
            indexService.removeShard(shardRouting.getId(), message);
        } catch (ShardNotFoundException e) {
            // the node got closed on us, ignore it
        } catch (Throwable e1) {
            logger.warn("[{}][{}] failed to remove shard after failure ([{}])", e1, shardRouting.getIndex(), shardRouting.getId(), message);
        }
    }
    if (sendShardFailure) {
        sendFailShard(shardRouting, indexService.indexUUID(), message, failure);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:IndicesClusterStateService.java


注:本文中的org.elasticsearch.index.IndexService.hasShard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。