當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。