org.elasticsearch.transport.TransportService Java Examples

The following examples show how to use org.elasticsearch.transport.TransportService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CronTransportAction.java    From anomaly-detection with Apache License 2.0 6 votes vote down vote up
@Inject
public CronTransportAction(
    ThreadPool threadPool,
    ClusterService clusterService,
    TransportService transportService,
    ActionFilters actionFilters,
    ADStateManager tarnsportStatemanager,
    ModelManager modelManager,
    FeatureManager featureManager
) {
    super(
        CronAction.NAME,
        threadPool,
        clusterService,
        transportService,
        actionFilters,
        CronRequest::new,
        CronNodeRequest::new,
        ThreadPool.Names.MANAGEMENT,
        CronNodeResponse.class
    );
    this.transportStateManager = tarnsportStatemanager;
    this.modelManager = modelManager;
    this.featureManager = featureManager;
}
 
Example #2
Source File: TransportSwapAndDropIndexNameAction.java    From crate with Apache License 2.0 6 votes vote down vote up
@Inject
public TransportSwapAndDropIndexNameAction(TransportService transportService,
                                           ClusterService clusterService,
                                           ThreadPool threadPool,
                                           AllocationService allocationService,
                                           IndexNameExpressionResolver indexNameExpressionResolver) {
    super(ACTION_NAME,
        transportService,
        clusterService,
        threadPool,
        indexNameExpressionResolver,
        SwapAndDropIndexRequest::new,
        AcknowledgedResponse::new,
        AcknowledgedResponse::new,
        "swap-and-drop-index");
    executor = new SwapAndDropIndexExecutor(allocationService);
}
 
Example #3
Source File: TransportKillNodeAction.java    From crate with Apache License 2.0 6 votes vote down vote up
TransportKillNodeAction(String name,
                        TasksService tasksService,
                        ClusterService clusterService,
                        TransportService transportService,
                        Writeable.Reader<Request> reader) {
    this.tasksService = tasksService;
    this.clusterService = clusterService;
    this.transportService = transportService;
    this.reader = reader;
    this.name = name;
    transportService.registerRequestHandler(
        name,
        reader,
        ThreadPool.Names.GENERIC,
        new NodeActionRequestHandler<>(this));
}
 
Example #4
Source File: TransportShardUpsertAction.java    From crate with Apache License 2.0 6 votes vote down vote up
@Inject
public TransportShardUpsertAction(ThreadPool threadPool,
                                  ClusterService clusterService,
                                  TransportService transportService,
                                  SchemaUpdateClient schemaUpdateClient,
                                  TasksService tasksService,
                                  IndicesService indicesService,
                                  ShardStateAction shardStateAction,
                                  Functions functions,
                                  Schemas schemas,
                                  IndexNameExpressionResolver indexNameExpressionResolver) {
    super(
        ACTION_NAME,
        transportService,
        indexNameExpressionResolver,
        clusterService,
        indicesService,
        threadPool,
        shardStateAction,
        ShardUpsertRequest::new,
        schemaUpdateClient
    );
    this.schemas = schemas;
    this.functions = functions;
    tasksService.addListener(this);
}
 
Example #5
Source File: BlobService.java    From crate with Apache License 2.0 6 votes vote down vote up
@Inject
public BlobService(ClusterService clusterService,
                   BlobIndicesService blobIndicesService,
                   BlobHeadRequestHandler blobHeadRequestHandler,
                   PeerRecoverySourceService peerRecoverySourceService,
                   TransportService transportService,
                   BlobTransferTarget blobTransferTarget,
                   Client client,
                   PipelineRegistry pipelineRegistry,
                   Settings settings) {
    this.clusterService = clusterService;
    this.blobIndicesService = blobIndicesService;
    this.blobHeadRequestHandler = blobHeadRequestHandler;
    this.peerRecoverySourceService = peerRecoverySourceService;
    this.transportService = transportService;
    this.blobTransferTarget = blobTransferTarget;
    this.client = client;
    this.pipelineRegistry = pipelineRegistry;
    this.settings = settings;
}
 
Example #6
Source File: TransportRecoveryAction.java    From crate with Apache License 2.0 6 votes vote down vote up
@Inject
public TransportRecoveryAction(ThreadPool threadPool,
                               ClusterService clusterService,
                               TransportService transportService,
                               IndicesService indicesService,
                               IndexNameExpressionResolver indexNameExpressionResolver) {
    super(
        RecoveryAction.NAME,
        threadPool,
        clusterService,
        transportService,
        indexNameExpressionResolver,
        RecoveryRequest::new,
        ThreadPool.Names.MANAGEMENT,
        true
    );
    this.indicesService = indicesService;
}
 
Example #7
Source File: SnapshotShardsService.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@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());
    }

}
 
Example #8
Source File: BlobRecoverySource.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Inject
public BlobRecoverySource(Settings settings, TransportService transportService, IndicesService indicesService,
                          RecoverySettings recoverySettings, ClusterService clusterService,
                          BlobTransferTarget blobTransferTarget, BlobIndices blobIndices) {
    super(settings);
    this.transportService = transportService;
    this.indicesService = indicesService;
    this.clusterService = clusterService;
    this.blobTransferTarget = blobTransferTarget;
    this.blobIndices = blobIndices;
    this.indicesService.indicesLifecycle().addListener(new IndicesLifecycle.Listener() {
        @Override
        public void beforeIndexShardClosed(ShardId shardId, @Nullable IndexShard indexShard,
                                           Settings indexSettings) {
            if (indexShard != null) {
                ongoingRecoveries.cancel(indexShard, "shard is closed");
            }
        }
    });

    this.recoverySettings = recoverySettings;

}
 
Example #9
Source File: TransportCreateUserDefinedFunctionAction.java    From crate with Apache License 2.0 6 votes vote down vote up
@Inject
public TransportCreateUserDefinedFunctionAction(TransportService transportService,
                                                ClusterService clusterService,
                                                ThreadPool threadPool,
                                                UserDefinedFunctionService udfService,
                                                IndexNameExpressionResolver indexNameExpressionResolver) {
    super(
        "internal:crate:sql/udf/create",
        transportService,
        clusterService,
        threadPool,
        CreateUserDefinedFunctionRequest::new,
        indexNameExpressionResolver
    );
    this.udfService = udfService;
}
 
Example #10
Source File: AzureDiscoveryPlugin.java    From crate with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, Supplier<SeedHostsProvider>> getSeedHostProviders(TransportService transportService,
                                                                     NetworkService networkService) {
    return Collections.singletonMap(
        AzureConfiguration.AZURE,
        () -> {
            if (AzureConfiguration.isDiscoveryReady(settings, logger)) {
                return new AzureSeedHostsProvider(settings,
                                                  azureComputeService(),
                                                  transportService,
                                                  networkService);
            } else {
                return hostsResolver -> Collections.emptyList();
            }
        });
}
 
Example #11
Source File: TransportDeleteBlobAction.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Inject
public TransportDeleteBlobAction(Settings settings,
                                 TransportService transportService,
                                 ClusterService clusterService,
                                 IndicesService indicesService,
                                 ThreadPool threadPool,
                                 ShardStateAction shardStateAction,
                                 BlobIndices blobIndices,
                                 MappingUpdatedAction mappingUpdatedAction,
                                 ActionFilters actionFilters,
                                 IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, DeleteBlobAction.NAME, transportService, clusterService, indicesService, threadPool, shardStateAction,
            mappingUpdatedAction, actionFilters, indexNameExpressionResolver, DeleteBlobRequest.class, DeleteBlobRequest.class, ThreadPool.Names.INDEX);
    this.blobIndices = blobIndices;
    logger.trace("Constructor");
}
 
Example #12
Source File: TransportNodesListShardStoreMetaData.java    From crate with Apache License 2.0 6 votes vote down vote up
@Inject
public TransportNodesListShardStoreMetaData(Settings settings,
                                            ThreadPool threadPool,
                                            ClusterService clusterService,
                                            TransportService transportService,
                                            IndicesService indicesService,
                                            NodeEnvironment nodeEnv,
                                            IndexNameExpressionResolver indexNameExpressionResolver,
                                            NamedXContentRegistry namedXContentRegistry) {
    super(ACTION_NAME, threadPool, clusterService, transportService, indexNameExpressionResolver,
        Request::new, NodeRequest::new, ThreadPool.Names.FETCH_SHARD_STORE, NodeStoreFilesMetaData.class);
    this.settings = settings;
    this.indicesService = indicesService;
    this.nodeEnv = nodeEnv;
    this.namedXContentRegistry = namedXContentRegistry;
}
 
Example #13
Source File: TransportNodesAction.java    From crate with Apache License 2.0 6 votes vote down vote up
protected TransportNodesAction(String actionName,
                               ThreadPool threadPool,
                               ClusterService clusterService,
                               TransportService transportService,
                               IndexNameExpressionResolver indexNameExpressionResolver,
                               Writeable.Reader<NodesRequest> nodesRequestReader,
                               Writeable.Reader<NodeRequest> nodeRequestReader,
                               String nodeExecutor,
                               Class<NodeResponse> nodeResponseClass) {
    super(actionName, threadPool, transportService, nodesRequestReader, indexNameExpressionResolver);
    this.clusterService = Objects.requireNonNull(clusterService);
    this.transportService = Objects.requireNonNull(transportService);
    this.nodeResponseClass = Objects.requireNonNull(nodeResponseClass);

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

    transportService.registerRequestHandler(
        transportNodeAction, nodeRequestReader, nodeExecutor, new NodeTransportHandler());
}
 
Example #14
Source File: FaultDetection.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
public FaultDetection(Settings settings, ThreadPool threadPool, TransportService transportService, ClusterName clusterName) {
    super(settings);
    this.threadPool = threadPool;
    this.transportService = transportService;
    this.clusterName = clusterName;

    this.connectOnNetworkDisconnect = settings.getAsBoolean(SETTING_CONNECT_ON_NETWORK_DISCONNECT, false);
    this.pingInterval = settings.getAsTime(SETTING_PING_INTERVAL, timeValueSeconds(1));
    this.pingRetryTimeout = settings.getAsTime(SETTING_PING_TIMEOUT, timeValueSeconds(30));
    this.pingRetryCount = settings.getAsInt(SETTING_PING_RETRIES, 3);
    this.registerConnectionListener = settings.getAsBoolean(SETTING_REGISTER_CONNECTION_LISTENER, true);

    this.connectionListener = new FDConnectionListener();
    if (registerConnectionListener) {
        transportService.addConnectionListener(connectionListener);
    }
}
 
Example #15
Source File: TransportResyncReplicationAction.java    From crate with Apache License 2.0 6 votes vote down vote up
@Override
protected void registerRequestHandlers(String actionName,
                                       TransportService transportService,
                                       Writeable.Reader<ResyncReplicationRequest> reader,
                                       Writeable.Reader<ResyncReplicationRequest> replicaReader,
                                       String executor) {
    transportService.registerRequestHandler(actionName, reader, ThreadPool.Names.SAME, new OperationTransportHandler());
    // we should never reject resync because of thread pool capacity on primary
    transportService.registerRequestHandler(
        transportPrimaryAction,
        in -> new ConcreteShardRequest<>(in, reader),
        executor,
        true,
        true,
        new PrimaryOperationTransportHandler());
    transportService.registerRequestHandler(
        transportReplicaAction,
        in -> new ConcreteReplicaRequest<>(in, replicaReader),
        executor,
        true,
        true,
        new ReplicaOperationTransportHandler());
}
 
Example #16
Source File: TransportClientNodesService.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Inject
public TransportClientNodesService(Settings settings, ClusterName clusterName, TransportService transportService,
                                   ThreadPool threadPool, Headers headers, Version version) {
    super(settings);
    this.clusterName = clusterName;
    this.transportService = transportService;
    this.threadPool = threadPool;
    this.minCompatibilityVersion = version.minimumCompatibilityVersion();
    this.headers = headers;

    this.nodesSamplerInterval = this.settings.getAsTime("client.transport.nodes_sampler_interval", timeValueSeconds(5));
    this.pingTimeout = this.settings.getAsTime("client.transport.ping_timeout", timeValueSeconds(5)).millis();
    this.ignoreClusterName = this.settings.getAsBoolean("client.transport.ignore_cluster_name", false);

    if (logger.isDebugEnabled()) {
        logger.debug("node_sampler_interval[" + nodesSamplerInterval + "]");
    }

    if (this.settings.getAsBoolean("client.transport.sniff", false)) {
        this.nodesSampler = new SniffNodesSampler();
    } else {
        this.nodesSampler = new SimpleNodeSampler();
    }
    this.nodesSamplerFuture = threadPool.schedule(nodesSamplerInterval, ThreadPool.Names.GENERIC, new ScheduledNodeSampler());
}
 
Example #17
Source File: TransportSearchScrollAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportSearchScrollAction(Settings settings, ThreadPool threadPool, TransportService transportService,
                                   ClusterService clusterService, SearchServiceTransportAction searchService,
                                   SearchPhaseController searchPhaseController,
                                   ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, SearchScrollAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver,
            SearchScrollRequest.class);
    this.clusterService = clusterService;
    this.searchService = searchService;
    this.searchPhaseController = searchPhaseController;
}
 
Example #18
Source File: TransportAddVotingConfigExclusionsAction.java    From crate with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportAddVotingConfigExclusionsAction(TransportService transportService,
                                                ClusterService clusterService,
                                                ThreadPool threadPool,
                                                IndexNameExpressionResolver indexNameExpressionResolver) {
    super(AddVotingConfigExclusionsAction.NAME, transportService, clusterService, threadPool,
        AddVotingConfigExclusionsRequest::new, indexNameExpressionResolver);
}
 
Example #19
Source File: TransportPutIndexedScriptAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportPutIndexedScriptAction(Settings settings, ThreadPool threadPool, ScriptService scriptService,
                                       TransportService transportService, ActionFilters actionFilters,
                                       IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, PutIndexedScriptAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, PutIndexedScriptRequest.class);
    this.scriptService = scriptService;
}
 
Example #20
Source File: TransportClearCachesAction.java    From elasticsearch-learning-to-rank with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportClearCachesAction(Settings settings, ThreadPool threadPool,
                                     ClusterService clusterService, TransportService transportService,
                                     ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver,
                                     Caches caches) {
    super(ClearCachesAction.NAME, threadPool, clusterService, transportService, actionFilters,
            ClearCachesNodesRequest::new, ClearCachesNodeRequest::new, ThreadPool.Names.MANAGEMENT, ClearCachesNodeResponse.class);
    this.caches = caches;
}
 
Example #21
Source File: TransportResizeAction.java    From crate with Apache License 2.0 5 votes vote down vote up
protected TransportResizeAction(String actionName, TransportService transportService, ClusterService clusterService,
                             ThreadPool threadPool, MetaDataCreateIndexService createIndexService,
                             IndexNameExpressionResolver indexNameExpressionResolver, Client client) {
    super(actionName, transportService, clusterService, threadPool, ResizeRequest::new, indexNameExpressionResolver);
    this.createIndexService = createIndexService;
    this.client = client;
}
 
Example #22
Source File: AbstractDDLTransportAction.java    From crate with Apache License 2.0 5 votes vote down vote up
public AbstractDDLTransportAction(String actionName,
                                  TransportService transportService,
                                  ClusterService clusterService,
                                  ThreadPool threadPool,
                                  IndexNameExpressionResolver indexNameExpressionResolver,
                                  Writeable.Reader<Request> requestReader,
                                  Writeable.Reader<Response> responseReader,
                                  Function<Boolean, Response> ackedResponseFunction,
                                  String source) {
    super(actionName, transportService, clusterService, threadPool, requestReader, indexNameExpressionResolver);
    this.reader = responseReader;
    this.ackedResponseFunction = ackedResponseFunction;
    this.source = source;
}
 
Example #23
Source File: DeleteModelTransportActionTests.java    From anomaly-detection with Apache License 2.0 5 votes vote down vote up
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    ThreadPool threadPool = mock(ThreadPool.class);

    ClusterService clusterService = mock(ClusterService.class);
    localNodeID = "foo";
    when(clusterService.localNode()).thenReturn(new DiscoveryNode(localNodeID, buildNewFakeTransportAddress(), Version.CURRENT));
    when(clusterService.getClusterName()).thenReturn(new ClusterName("test"));

    TransportService transportService = mock(TransportService.class);
    ActionFilters actionFilters = mock(ActionFilters.class);
    ADStateManager tarnsportStatemanager = mock(ADStateManager.class);
    ModelManager modelManager = mock(ModelManager.class);
    FeatureManager featureManager = mock(FeatureManager.class);

    action = new DeleteModelTransportAction(
        threadPool,
        clusterService,
        transportService,
        actionFilters,
        tarnsportStatemanager,
        modelManager,
        featureManager
    );
}
 
Example #24
Source File: PreVoteCollector.java    From crate with Apache License 2.0 5 votes vote down vote up
PreVoteCollector(final TransportService transportService, final Runnable startElection, final LongConsumer updateMaxTermSeen) {
    this.transportService = transportService;
    this.startElection = startElection;
    this.updateMaxTermSeen = updateMaxTermSeen;

    // TODO does this need to be on the generic threadpool or can it use SAME?
    transportService.registerRequestHandler(REQUEST_PRE_VOTE_ACTION_NAME, Names.GENERIC, false, false,
        PreVoteRequest::new,
        (request, channel, task) -> channel.sendResponse(handlePreVoteRequest(request)));
}
 
Example #25
Source File: EnterpriseLicenseService.java    From crate with Apache License 2.0 5 votes vote down vote up
@Inject
public EnterpriseLicenseService(TransportService transportService,
                                TransportSetLicenseAction transportSetLicenseAction) {
    this.transportService = transportService;
    this.transportSetLicenseAction = transportSetLicenseAction;
    this.logger = LogManager.getLogger(getClass());
}
 
Example #26
Source File: TransportNodePrometheusMetricsAction.java    From elasticsearch-prometheus-exporter with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportNodePrometheusMetricsAction(Settings settings, Client client,
                                            TransportService transportService, ActionFilters actionFilters,
                                            ClusterSettings clusterSettings) {
    super(NodePrometheusMetricsAction.NAME, transportService, actionFilters,
            NodePrometheusMetricsRequest::new);
    this.client = client;
    this.settings = settings;
    this.clusterSettings = clusterSettings;
    this.prometheusSettings = new PrometheusSettings(settings, clusterSettings);
}
 
Example #27
Source File: RaigadUnicastHostsProvider.java    From Raigad with Apache License 2.0 5 votes vote down vote up
RaigadUnicastHostsProvider(Settings settings, TransportService transportService) {
    super(settings);
    this.transportService = transportService;

    nodeName = settings.get("node.name");
    logger.info("[raigad-discovery] Node name [{}]", nodeName);
}
 
Example #28
Source File: TransportValidateQueryAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportValidateQueryAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                                    TransportService transportService, IndicesService indicesService,
                                    ScriptService scriptService, PageCacheRecycler pageCacheRecycler,
                                    BigArrays bigArrays, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, ValidateQueryAction.NAME, threadPool, clusterService, transportService, actionFilters,
            indexNameExpressionResolver, ValidateQueryRequest.class, ShardValidateQueryRequest.class, ThreadPool.Names.SEARCH);
    this.indicesService = indicesService;
    this.scriptService = scriptService;
    this.pageCacheRecycler = pageCacheRecycler;
    this.bigArrays = bigArrays;
}
 
Example #29
Source File: ADStatsNodesTransportActionTests.java    From anomaly-detection with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    super.setUp();

    Client client = client();
    Clock clock = mock(Clock.class);
    Throttler throttler = new Throttler(clock);
    ThreadPool threadPool = mock(ThreadPool.class);
    IndexUtils indexUtils = new IndexUtils(client, new ClientUtil(Settings.EMPTY, client, throttler, threadPool), clusterService());
    ModelManager modelManager = mock(ModelManager.class);

    clusterStatName1 = "clusterStat1";
    clusterStatName2 = "clusterStat2";
    nodeStatName1 = "nodeStat1";
    nodeStatName2 = "nodeStat2";

    statsMap = new HashMap<String, ADStat<?>>() {
        {
            put(nodeStatName1, new ADStat<>(false, new CounterSupplier()));
            put(nodeStatName2, new ADStat<>(false, new ModelsOnNodeSupplier(modelManager)));
            put(clusterStatName1, new ADStat<>(true, new IndexStatusSupplier(indexUtils, "index1")));
            put(clusterStatName2, new ADStat<>(true, new IndexStatusSupplier(indexUtils, "index2")));
        }
    };

    adStats = new ADStats(indexUtils, modelManager, statsMap);

    action = new ADStatsNodesTransportAction(
        client().threadPool(),
        clusterService(),
        mock(TransportService.class),
        mock(ActionFilters.class),
        adStats
    );
}
 
Example #30
Source File: TransportDeleteAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportDeleteAction(Settings settings, TransportService transportService, ClusterService clusterService,
                             IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction,
                             TransportCreateIndexAction createIndexAction, ActionFilters actionFilters,
                             IndexNameExpressionResolver indexNameExpressionResolver, MappingUpdatedAction mappingUpdatedAction,
                             AutoCreateIndex autoCreateIndex) {
    super(settings, DeleteAction.NAME, transportService, clusterService, indicesService, threadPool, shardStateAction,
            mappingUpdatedAction, actionFilters, indexNameExpressionResolver,
            DeleteRequest.class, DeleteRequest.class, ThreadPool.Names.INDEX);
    this.createIndexAction = createIndexAction;
    this.autoCreateIndex = autoCreateIndex;
}