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: 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 #2
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 #3
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 #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
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 #11
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 #12
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 #13
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 #14
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 #15
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 #16
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 #17
Source File: TransportDumpAction.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportDumpAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                           TransportService transportService, IndicesService indicesService,
                           ScriptService scriptService, CacheRecycler cacheRecycler,
                           DumpParser dumpParser, Exporter exporter, NodeEnvironment nodeEnv) {
    super(settings, threadPool, clusterService, transportService, indicesService, scriptService,
        cacheRecycler, dumpParser, exporter, nodeEnv);
}
 
Example #18
Source File: TransportPrivilegesAction.java    From crate with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportPrivilegesAction(TransportService transportService,
                                 ClusterService clusterService,
                                 ThreadPool threadPool,
                                 IndexNameExpressionResolver indexNameExpressionResolver) {
    super(
        ACTION_NAME,
        transportService,
        clusterService,
        threadPool,
        PrivilegesRequest::new,
        indexNameExpressionResolver
    );
}
 
Example #19
Source File: RepositoriesService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #20
Source File: TransportSyncedFlushAction.java    From crate with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportSyncedFlushAction(ThreadPool threadPool,
                                  TransportService transportService,
                                  IndexNameExpressionResolver indexNameExpressionResolver,
                                  SyncedFlushService syncedFlushService) {
    super(SyncedFlushAction.NAME, threadPool, transportService, SyncedFlushRequest::new, indexNameExpressionResolver);
    this.syncedFlushService = syncedFlushService;
}
 
Example #21
Source File: TransportNodesListGatewayMetaState.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportNodesListGatewayMetaState(Settings settings, ClusterName clusterName, ThreadPool threadPool,
                                          ClusterService clusterService, TransportService transportService,
                                          ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, ACTION_NAME, clusterName, threadPool, clusterService, transportService, actionFilters,
            indexNameExpressionResolver, Request.class, NodeRequest.class, ThreadPool.Names.GENERIC);
}
 
Example #22
Source File: TransportExportAction.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportExportAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                             TransportService transportService, IndicesService indicesService,
                             ScriptService scriptService, CacheRecycler cacheRecycler,
                             ExportParser exportParser, Exporter exporter, NodeEnvironment nodeEnv) {
    super(settings, threadPool, clusterService, transportService, indicesService, scriptService,
        cacheRecycler, exportParser, exporter, nodeEnv);
}
 
Example #23
Source File: TransportDecommissionNodeAction.java    From crate with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportDecommissionNodeAction(TransportService transportService,
                                       DecommissioningService decommissioningService,
                                       Transports transports) {
    this.decommissioningService = decommissioningService;
    this.transports = transports;

    transportService.registerRequestHandler(ACTION_NAME,
        in -> DecommissionNodeRequest.INSTANCE,
        EXECUTOR,
        new NodeActionRequestHandler<>(this)
    );
}
 
Example #24
Source File: TransportLeaderShardIngestAction.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportLeaderShardIngestAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                        IndicesService indicesService, ThreadPool threadPool,
                                        ActionFilters actionFilters,
                                        IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, IngestAction.NAME, threadPool, actionFilters, indexNameExpressionResolver, transportService.getTaskManager());
    this.transportService = transportService;
    this.clusterService = clusterService;
    this.indicesService = indicesService;
    this.transportAction = transportAction();
    this.transportOptions = transportOptions();
    this.executor = executor();
    transportService.registerRequestHandler(transportAction, IngestLeaderShardRequest.class,
            ThreadPool.Names.SAME, new LeaderOperationTransportHandler());
}
 
Example #25
Source File: BlobHeadRequestHandler.java    From crate with Apache License 2.0 5 votes vote down vote up
@Inject
public BlobHeadRequestHandler(TransportService transportService, ClusterService clusterService,
                              BlobTransferTarget blobTransferTarget, ThreadPool threadPool) {
    this.blobTransferTarget = blobTransferTarget;
    this.clusterService = clusterService;
    this.transportService = transportService;
    this.threadPool = threadPool;
}
 
Example #26
Source File: TransportDistributedResultActionTest.java    From crate with Apache License 2.0 5 votes vote down vote up
@Test
public void testKillIsInvokedIfContextIsNotFound() throws Exception {
    TasksService tasksService = new TasksService(clusterService, new JobsLogs(() -> false));
    AtomicInteger numBroadcasts = new AtomicInteger(0);
    TransportKillJobsNodeAction killJobsAction = new TransportKillJobsNodeAction(
        tasksService,
        clusterService,
        mock(TransportService.class)
    ) {
        @Override
        public void broadcast(KillJobsRequest request, ActionListener<Long> listener, Collection<String> excludedNodeIds) {
            numBroadcasts.incrementAndGet();
        }
    };
    TransportDistributedResultAction transportDistributedResultAction = new TransportDistributedResultAction(
        mock(Transports.class),
        tasksService,
        THREAD_POOL,
        mock(TransportService.class),
        clusterService,
        killJobsAction,
        BackoffPolicy.exponentialBackoff(TimeValue.ZERO, 0)
    );

    StreamBucket.Builder builder = new StreamBucket.Builder(
        new Streamer[0], RamAccounting.NO_ACCOUNTING);
    try {
        transportDistributedResultAction.nodeOperation(
            new DistributedResultRequest(UUID.randomUUID(), 0, (byte) 0, 0, builder.build(), true)
        ).get(5, TimeUnit.SECONDS);
        fail("nodeOperation call should fail with TaskMissing");
    } catch (ExecutionException e) {
        assertThat(e.getCause(), Matchers.instanceOf(TaskMissing.class));
    }

    assertThat(numBroadcasts.get(), is(1));
}
 
Example #27
Source File: TransportDeleteSnapshotAction.java    From crate with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportDeleteSnapshotAction(TransportService transportService, ClusterService clusterService,
                                     ThreadPool threadPool, SnapshotsService snapshotsService,
                                     IndexNameExpressionResolver indexNameExpressionResolver) {
    super(DeleteSnapshotAction.NAME, transportService, clusterService, threadPool,
        DeleteSnapshotRequest::new, indexNameExpressionResolver);
    this.snapshotsService = snapshotsService;
}
 
Example #28
Source File: TransportDeleteRepositoryAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public TransportDeleteRepositoryAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                       RepositoriesService repositoriesService, ThreadPool threadPool, ActionFilters actionFilters,
                                       IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, DeleteRepositoryAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, DeleteRepositoryRequest.class);
    this.repositoriesService = repositoriesService;
}
 
Example #29
Source File: TransportReplicationAction.java    From crate with Apache License 2.0 5 votes vote down vote up
protected TransportReplicationAction(String actionName,
                                     TransportService transportService,
                                     ClusterService clusterService,
                                     IndicesService indicesService,
                                     ThreadPool threadPool,
                                     ShardStateAction shardStateAction,
                                     IndexNameExpressionResolver indexNameExpressionResolver,
                                     Writeable.Reader<Request> reader,
                                     Writeable.Reader<ReplicaRequest> replicaReader,
                                     String executor) {
    this(actionName, transportService, clusterService, indicesService, threadPool, shardStateAction,
            indexNameExpressionResolver, reader, replicaReader, executor, false);
}
 
Example #30
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;
}