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


Java DiscoveryNode.masterNode方法代码示例

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


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

示例1: SnapshotShardsService

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
@Inject
public SnapshotShardsService(Settings settings, ClusterService clusterService, SnapshotsService snapshotsService, ThreadPool threadPool,
                             TransportService transportService, IndicesService indicesService) {
    super(settings);
    this.indicesService = indicesService;
    this.snapshotsService = snapshotsService;
    this.transportService = transportService;
    this.clusterService = clusterService;
    this.threadPool = threadPool;
    if (DiscoveryNode.dataNode(settings)) {
        // this is only useful on the nodes that can hold data
        // addLast to make sure that Repository will be created before snapshot
        clusterService.addLast(this);
    }

    if (DiscoveryNode.masterNode(settings)) {
        // This needs to run only on nodes that can become masters
        transportService.registerRequestHandler(UPDATE_SNAPSHOT_ACTION_NAME, UpdateIndexShardSnapshotStatusRequest.class, ThreadPool.Names.SAME, new UpdateSnapshotStateRequestHandler());
    }

}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:22,代码来源:SnapshotShardsService.java

示例2: hasEnoughMasterNodes

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
public boolean hasEnoughMasterNodes(Iterable<DiscoveryNode> nodes) {
    if (minimumMasterNodes < 1) {
        return true;
    }
    int count = 0;
    for (DiscoveryNode node : nodes) {
        if (node.masterNode()) {
            count++;
        }
    }
    return count >= minimumMasterNodes;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:ElectMasterService.java

示例3: sortedMasterNodes

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
private List<DiscoveryNode> sortedMasterNodes(Iterable<DiscoveryNode> nodes) {
    List<DiscoveryNode> possibleNodes = CollectionUtils.iterableAsArrayList(nodes);
    if (possibleNodes.isEmpty()) {
        return null;
    }
    // clean non master nodes
    for (Iterator<DiscoveryNode> it = possibleNodes.iterator(); it.hasNext(); ) {
        DiscoveryNode node = it.next();
        if (!node.masterNode()) {
            it.remove();
        }
    }
    CollectionUtil.introSort(possibleNodes, nodeComparator);
    return possibleNodes;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:16,代码来源:ElectMasterService.java

示例4: compare

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
@Override
public int compare(DiscoveryNode o1, DiscoveryNode o2) {
    if (o1.masterNode() && !o2.masterNode()) {
        return -1;
    }
    if (!o1.masterNode() && o2.masterNode()) {
        return 1;
    }
    return o1.id().compareTo(o2.id());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:ElectMasterService.java

示例5: RepositoriesService

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
@Inject
public RepositoriesService(Settings settings, ClusterService clusterService, TransportService transportService, RepositoryTypesRegistry typesRegistry, Injector injector) {
    super(settings);
    this.typesRegistry = typesRegistry;
    this.injector = injector;
    this.clusterService = clusterService;
    // Doesn't make sense to maintain repositories on non-master and non-data nodes
    // Nothing happens there anyway
    if (DiscoveryNode.dataNode(settings) || DiscoveryNode.masterNode(settings)) {
        clusterService.add(this);
    }
    this.verifyAction = new VerifyNodeRepositoryAction(settings, transportService, clusterService, this);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:14,代码来源:RepositoriesService.java

示例6: GatewayMetaState

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
@Inject
public GatewayMetaState(Settings settings, NodeEnvironment nodeEnv, MetaStateService metaStateService,
                        DanglingIndicesState danglingIndicesState, TransportNodesListGatewayMetaState nodesListGatewayMetaState,
                        MetaDataIndexUpgradeService metaDataIndexUpgradeService) throws Exception {
    super(settings);
    this.nodeEnv = nodeEnv;
    this.metaStateService = metaStateService;
    this.danglingIndicesState = danglingIndicesState;
    this.metaDataIndexUpgradeService = metaDataIndexUpgradeService;
    nodesListGatewayMetaState.init(this);

    if (DiscoveryNode.dataNode(settings)) {
        ensureNoPre019ShardState(nodeEnv);
        MultiDataPathUpgrader.upgradeMultiDataPath(nodeEnv, logger);
    }

    if (DiscoveryNode.masterNode(settings) || DiscoveryNode.dataNode(settings)) {
        nodeEnv.ensureAtomicMoveSupported();
    }
    if (DiscoveryNode.masterNode(settings) || DiscoveryNode.dataNode(settings)) {
        try {
            ensureNoPre019State();
            pre20Upgrade();
            long startNS = System.nanoTime();
            metaStateService.loadFullState();
            logger.debug("took {} to load state", TimeValue.timeValueMillis(TimeValue.nsecToMSec(System.nanoTime() - startNS)));
        } catch (Exception e) {
            logger.error("failed to read local state, exiting...", e);
            throw e;
        }
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:33,代码来源:GatewayMetaState.java

示例7: SnapshotsService

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
@Inject
public SnapshotsService(Settings settings, ClusterService clusterService, IndexNameExpressionResolver indexNameExpressionResolver, RepositoriesService repositoriesService, ThreadPool threadPool) {
    super(settings);
    this.clusterService = clusterService;
    this.indexNameExpressionResolver = indexNameExpressionResolver;
    this.repositoriesService = repositoriesService;
    this.threadPool = threadPool;

    if (DiscoveryNode.masterNode(settings)) {
        // addLast to make sure that Repository will be created before snapshot
        clusterService.addLast(this);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:14,代码来源:SnapshotsService.java

示例8: addNodeInfo

import org.elasticsearch.cluster.node.DiscoveryNode; //导入方法依赖的package包/类
public void addNodeInfo(NodeInfo nodeInfo) {
    total++;
    DiscoveryNode node = nodeInfo.getNode();
    if (node.masterNode()) {
        if (node.dataNode()) {
            masterData++;
        } else {
            masterOnly++;
        }
    } else if (node.dataNode()) {
        dataOnly++;
    } else if (node.clientNode()) {
        client++;
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:16,代码来源:ClusterStatsNodes.java


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