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


Java ClusterService类代码示例

本文整理汇总了Java中org.elasticsearch.cluster.service.ClusterService的典型用法代码示例。如果您正苦于以下问题:Java ClusterService类的具体用法?Java ClusterService怎么用?Java ClusterService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: routingKeyForShard

import org.elasticsearch.cluster.service.ClusterService; //导入依赖的package包/类
synchronized String routingKeyForShard(Index index, int shard, Random random) {
    assertThat(shard, greaterThanOrEqualTo(0));
    assertThat(shard, greaterThanOrEqualTo(0));
    for (NodeAndClient n : nodes.values()) {
        Node node = n.node;
        IndicesService indicesService = getInstanceFromNode(IndicesService.class, node);
        ClusterService clusterService = getInstanceFromNode(ClusterService.class, node);
        IndexService indexService = indicesService.indexService(index);
        if (indexService != null) {
            assertThat(indexService.getIndexSettings().getSettings().getAsInt(IndexMetaData.SETTING_NUMBER_OF_SHARDS, -1), greaterThan(shard));
            OperationRouting operationRouting = clusterService.operationRouting();
            while (true) {
                String routing = RandomStrings.randomAsciiOfLength(random, 10);
                final int targetShard = operationRouting.indexShards(clusterService.state(), index.getName(), null, routing).shardId().getId();
                if (shard == targetShard) {
                    return routing;
                }
            }
        }
    }
    fail("Could not find a node that holds " + index);
    return null;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:InternalTestCluster.java

示例2: TestTransportBulkAction

import org.elasticsearch.cluster.service.ClusterService; //导入依赖的package包/类
TestTransportBulkAction(
        Settings settings,
        ThreadPool threadPool,
        TransportService transportService,
        ClusterService clusterService,
        TransportShardBulkAction shardBulkAction,
        TransportCreateIndexAction createIndexAction,
        ActionFilters actionFilters,
        IndexNameExpressionResolver indexNameExpressionResolver,
        AutoCreateIndex autoCreateIndex,
        LongSupplier relativeTimeProvider) {
    super(
            settings,
            threadPool,
            transportService,
            clusterService,
            null,
            shardBulkAction,
            createIndexAction,
            actionFilters,
            indexNameExpressionResolver,
            autoCreateIndex,
            relativeTimeProvider);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:TransportBulkActionTookTests.java

示例3: TransportBroadcastByNodeAction

import org.elasticsearch.cluster.service.ClusterService; //导入依赖的package包/类
public TransportBroadcastByNodeAction(
        Settings settings,
        String actionName,
        ThreadPool threadPool,
        ClusterService clusterService,
        TransportService transportService,
        ActionFilters actionFilters,
        IndexNameExpressionResolver indexNameExpressionResolver,
        Supplier<Request> request,
        String executor,
        boolean canTripCircuitBreaker) {
    super(settings, actionName, canTripCircuitBreaker, threadPool, transportService, actionFilters, indexNameExpressionResolver,
        request);

    this.clusterService = clusterService;
    this.transportService = transportService;

    transportNodeBroadcastAction = actionName + "[n]";

    transportService.registerRequestHandler(transportNodeBroadcastAction, NodeRequest::new, executor, false, canTripCircuitBreaker,
        new BroadcastByNodeTransportRequestHandler());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:TransportBroadcastByNodeAction.java

示例4: PeerRecoveryTargetService

import org.elasticsearch.cluster.service.ClusterService; //导入依赖的package包/类
public PeerRecoveryTargetService(Settings settings, ThreadPool threadPool, TransportService transportService, RecoverySettings
        recoverySettings, ClusterService clusterService) {
    super(settings);
    this.threadPool = threadPool;
    this.transportService = transportService;
    this.recoverySettings = recoverySettings;
    this.clusterService = clusterService;
    this.onGoingRecoveries = new RecoveriesCollection(logger, threadPool, this::waitForClusterState);

    transportService.registerRequestHandler(Actions.FILES_INFO, RecoveryFilesInfoRequest::new, ThreadPool.Names.GENERIC, new
            FilesInfoRequestHandler());
    transportService.registerRequestHandler(Actions.FILE_CHUNK, RecoveryFileChunkRequest::new, ThreadPool.Names.GENERIC, new
            FileChunkTransportRequestHandler());
    transportService.registerRequestHandler(Actions.CLEAN_FILES, RecoveryCleanFilesRequest::new, ThreadPool.Names.GENERIC, new
            CleanFilesRequestHandler());
    transportService.registerRequestHandler(Actions.PREPARE_TRANSLOG, RecoveryPrepareForTranslogOperationsRequest::new, ThreadPool
            .Names.GENERIC, new PrepareForTranslogOperationsRequestHandler());
    transportService.registerRequestHandler(Actions.TRANSLOG_OPS, RecoveryTranslogOperationsRequest::new, ThreadPool.Names.GENERIC,
            new TranslogOperationsRequestHandler());
    transportService.registerRequestHandler(Actions.FINALIZE, RecoveryFinalizeRecoveryRequest::new, ThreadPool.Names.GENERIC, new
            FinalizeRecoveryRequestHandler());
    transportService.registerRequestHandler(Actions.WAIT_CLUSTERSTATE, RecoveryWaitForClusterStateRequest::new,
        ThreadPool.Names.GENERIC, new WaitForClusterStateRequestHandler());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:PeerRecoveryTargetService.java

示例5: TransportNodesAction

import org.elasticsearch.cluster.service.ClusterService; //导入依赖的package包/类
protected TransportNodesAction(Settings settings, String actionName, ThreadPool threadPool,
                               ClusterService clusterService, TransportService transportService, ActionFilters actionFilters,
                               IndexNameExpressionResolver indexNameExpressionResolver,
                               Supplier<NodesRequest> request, Supplier<NodeRequest> nodeRequest,
                               String nodeExecutor,
                               Class<NodeResponse> nodeResponseClass) {
    super(settings, actionName, threadPool, transportService, actionFilters, indexNameExpressionResolver, request);
    this.clusterService = Objects.requireNonNull(clusterService);
    this.transportService = Objects.requireNonNull(transportService);
    this.nodeResponseClass = Objects.requireNonNull(nodeResponseClass);

    this.transportNodeAction = actionName + "[n]";

    transportService.registerRequestHandler(
        transportNodeAction, nodeRequest, nodeExecutor, new NodeTransportHandler());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:TransportNodesAction.java

示例6: deleteStoredScript

import org.elasticsearch.cluster.service.ClusterService; //导入依赖的package包/类
public void deleteStoredScript(ClusterService clusterService, DeleteStoredScriptRequest request,
                               ActionListener<DeleteStoredScriptResponse> listener) {
    if (request.lang() != null && isLangSupported(request.lang()) == false) {
        throw new IllegalArgumentException("unable to delete stored script with unsupported lang [" + request.lang() +"]");
    }

    clusterService.submitStateUpdateTask("delete-script-" + request.id(),
        new AckedClusterStateUpdateTask<DeleteStoredScriptResponse>(request, listener) {

        @Override
        protected DeleteStoredScriptResponse newResponse(boolean acknowledged) {
            return new DeleteStoredScriptResponse(acknowledged);
        }

        @Override
        public ClusterState execute(ClusterState currentState) throws Exception {
            ScriptMetaData smd = currentState.metaData().custom(ScriptMetaData.TYPE);
            smd = ScriptMetaData.deleteStoredScript(smd, request.id(), request.lang());
            MetaData.Builder mdb = MetaData.builder(currentState.getMetaData()).putCustom(ScriptMetaData.TYPE, smd);

            return ClusterState.builder(currentState).metaData(mdb).build();
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:ScriptService.java

示例7: testClusterStateIsNotChangedWithIdenticalMappings

import org.elasticsearch.cluster.service.ClusterService; //导入依赖的package包/类
public void testClusterStateIsNotChangedWithIdenticalMappings() throws Exception {
    createIndex("test", client().admin().indices().prepareCreate("test").addMapping("type"));

    final MetaDataMappingService mappingService = getInstanceFromNode(MetaDataMappingService.class);
    final ClusterService clusterService = getInstanceFromNode(ClusterService.class);
    final PutMappingClusterStateUpdateRequest request = new PutMappingClusterStateUpdateRequest().type("type");
    request.source("{ \"properties\" { \"field\": { \"type\": \"string\" }}}");
    ClusterState result = mappingService.putMappingExecutor.execute(clusterService.state(), Collections.singletonList(request))
        .resultingState;

    assertFalse(result != clusterService.state());

    ClusterState result2 = mappingService.putMappingExecutor.execute(result, Collections.singletonList(request))
        .resultingState;

    assertSame(result, result2);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:MetaDataMappingServiceTests.java

示例8: createIndicesClusterStateService

import org.elasticsearch.cluster.service.ClusterService; //导入依赖的package包/类
private IndicesClusterStateService createIndicesClusterStateService(DiscoveryNode discoveryNode,
                                                                    final Supplier<MockIndicesService> indicesServiceSupplier) {
    final ThreadPool threadPool = mock(ThreadPool.class);
    when(threadPool.generic()).thenReturn(mock(ExecutorService.class));
    final MockIndicesService indicesService = indicesServiceSupplier.get();
    final Settings settings = Settings.builder().put("node.name", discoveryNode.getName()).build();
    final TransportService transportService = new TransportService(settings, null, threadPool,
        TransportService.NOOP_TRANSPORT_INTERCEPTOR,
        boundAddress -> DiscoveryNode.createLocal(settings, boundAddress.publishAddress(), UUIDs.randomBase64UUID()), null);
    final ClusterService clusterService = mock(ClusterService.class);
    final RepositoriesService repositoriesService = new RepositoriesService(settings, clusterService,
        transportService, null);
    final PeerRecoveryTargetService recoveryTargetService = new PeerRecoveryTargetService(settings, threadPool,
        transportService, null, clusterService);
    final ShardStateAction shardStateAction = mock(ShardStateAction.class);
    return new IndicesClusterStateService(
        settings,
        indicesService,
        clusterService,
        threadPool,
        recoveryTargetService,
        shardStateAction,
        null,
        repositoriesService,
        null,
        null,
        null,
        null,
        shardId -> {});
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:31,代码来源:IndicesClusterStateServiceRandomUpdatesTests.java

示例9: TransportRethrottleAction

import org.elasticsearch.cluster.service.ClusterService; //导入依赖的package包/类
@Inject
public TransportRethrottleAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
        TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver,
        Client client) {
    super(settings, RethrottleAction.NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver,
            RethrottleRequest::new, ListTasksResponse::new, ThreadPool.Names.MANAGEMENT);
    this.client = client;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:TransportRethrottleAction.java

示例10: TransportReindexAction

import org.elasticsearch.cluster.service.ClusterService; //导入依赖的package包/类
@Inject
public TransportReindexAction(Settings settings, ThreadPool threadPool, ActionFilters actionFilters,
        IndexNameExpressionResolver indexNameExpressionResolver, ClusterService clusterService, ScriptService scriptService,
        AutoCreateIndex autoCreateIndex, Client client, TransportService transportService) {
    super(settings, ReindexAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver,
            ReindexRequest::new);
    this.clusterService = clusterService;
    this.scriptService = scriptService;
    this.autoCreateIndex = autoCreateIndex;
    this.client = client;
    remoteWhitelist = buildRemoteWhitelist(REMOTE_CLUSTER_WHITELIST.get(settings));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:TransportReindexAction.java

示例11: TransportClearIndicesCacheAction

import org.elasticsearch.cluster.service.ClusterService; //导入依赖的package包/类
@Inject
public TransportClearIndicesCacheAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                                        TransportService transportService, IndicesService indicesService, ActionFilters actionFilters,
                                        IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, ClearIndicesCacheAction.NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver,
            ClearIndicesCacheRequest::new, ThreadPool.Names.MANAGEMENT, false);
    this.indicesService = indicesService;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:TransportClearIndicesCacheAction.java

示例12: getDiscoveryTypes

import org.elasticsearch.cluster.service.ClusterService; //导入依赖的package包/类
@Override
public Map<String, Supplier<Discovery>> getDiscoveryTypes(ThreadPool threadPool, TransportService transportService,
                                                          NamedWriteableRegistry namedWriteableRegistry,
                                                          ClusterService clusterService, UnicastHostsProvider hostsProvider) {
    // this is for backcompat with pre 5.1, where users would set discovery.type to use ec2 hosts provider
    return Collections.singletonMap(GCE, () ->
        new ZenDiscovery(settings, threadPool, transportService, namedWriteableRegistry, clusterService, hostsProvider));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:GceDiscoveryPlugin.java

示例13: MockInternalClusterInfoService

import org.elasticsearch.cluster.service.ClusterService; //导入依赖的package包/类
public MockInternalClusterInfoService(Settings settings, ClusterService clusterService, ThreadPool threadPool, NodeClient client) {
    super(settings, clusterService, threadPool, client);
    this.clusterName = ClusterName.CLUSTER_NAME_SETTING.get(settings);
    stats[0] = makeStats("node_t1", new DiskUsage("node_t1", "n1", "/dev/null", 100, 100));
    stats[1] = makeStats("node_t2", new DiskUsage("node_t2", "n2", "/dev/null", 100, 100));
    stats[2] = makeStats("node_t3", new DiskUsage("node_t3", "n3", "/dev/null", 100, 100));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:MockInternalClusterInfoService.java

示例14: TransportSearchAction

import org.elasticsearch.cluster.service.ClusterService; //导入依赖的package包/类
@Inject
public TransportSearchAction(Settings settings, ThreadPool threadPool, TransportService transportService, SearchService searchService,
                             SearchTransportService searchTransportService, SearchPhaseController searchPhaseController,
                             ClusterService clusterService, ActionFilters actionFilters,
                             IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, SearchAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, SearchRequest::new);
    this.searchPhaseController = searchPhaseController;
    this.searchTransportService = searchTransportService;
    this.remoteClusterService = searchTransportService.getRemoteClusterService();
    SearchTransportService.registerRequestHandler(transportService, searchService);
    this.clusterService = clusterService;
    this.searchService = searchService;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:TransportSearchAction.java

示例15: TransportClusterAllocationExplainAction

import org.elasticsearch.cluster.service.ClusterService; //导入依赖的package包/类
@Inject
public TransportClusterAllocationExplainAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                               ThreadPool threadPool, ActionFilters actionFilters,
                                               IndexNameExpressionResolver indexNameExpressionResolver,
                                               ClusterInfoService clusterInfoService, AllocationDeciders allocationDeciders,
                                               ShardsAllocator shardAllocator, GatewayAllocator gatewayAllocator) {
    super(settings, ClusterAllocationExplainAction.NAME, transportService, clusterService, threadPool, actionFilters,
            indexNameExpressionResolver, ClusterAllocationExplainRequest::new);
    this.clusterInfoService = clusterInfoService;
    this.allocationDeciders = allocationDeciders;
    this.shardAllocator = shardAllocator;
    this.gatewayAllocator = gatewayAllocator;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:TransportClusterAllocationExplainAction.java


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