org.elasticsearch.threadpool.ThreadPool Java Examples

The following examples show how to use org.elasticsearch.threadpool.ThreadPool. 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 Project: deprecated-security-advanced-modules   Author: opendistro-for-elasticsearch   File: InternalUsersApiAction.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public InternalUsersApiAction(final Settings settings, final Path configPath, final RestController controller,
        final Client client, final AdminDNs adminDNs, final ConfigurationRepository cl,
        final ClusterService cs, final PrincipalExtractor principalExtractor, final PrivilegesEvaluator evaluator,
        ThreadPool threadPool, AuditLog auditLog) {
    super(settings, configPath, controller, client, adminDNs, cl, cs, principalExtractor, evaluator, threadPool,
            auditLog);

    // legacy mapping for backwards compatibility
    // TODO: remove in next version
    controller.registerHandler(Method.GET, "/_opendistro/_security/api/user/{name}", this);
    controller.registerHandler(Method.GET, "/_opendistro/_security/api/user/", this);
    controller.registerHandler(Method.DELETE, "/_opendistro/_security/api/user/{name}", this);
    controller.registerHandler(Method.PUT, "/_opendistro/_security/api/user/{name}", this);

    // corrected mapping, introduced in Open Distro Security
    controller.registerHandler(Method.GET, "/_opendistro/_security/api/internalusers/{name}", this);
    controller.registerHandler(Method.GET, "/_opendistro/_security/api/internalusers/", this);
    controller.registerHandler(Method.DELETE, "/_opendistro/_security/api/internalusers/{name}", this);
    controller.registerHandler(Method.PUT, "/_opendistro/_security/api/internalusers/{name}", this);
    controller.registerHandler(Method.PATCH, "/_opendistro/_security/api/internalusers/", this);
    controller.registerHandler(Method.PATCH, "/_opendistro/_security/api/internalusers/{name}", this);

}
 
Example #2
Source Project: crate   Author: crate   File: NodeStatsContextFieldResolver.java    License: Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
NodeStatsContextFieldResolver(Supplier<DiscoveryNode> localNode,
                              MonitorService monitorService,
                              Supplier<TransportAddress> boundHttpAddress,
                              Supplier<HttpStats> httpStatsSupplier,
                              ThreadPool threadPool,
                              ExtendedNodeInfo extendedNodeInfo,
                              Supplier<ConnectionStats> psqlStats,
                              Supplier<TransportAddress> boundPostgresAddress,
                              LongSupplier numOpenTransportConnections,
                              LongSupplier clusterStateVersion) {
    this.localNode = localNode;
    processService = monitorService.processService();
    osService = monitorService.osService();
    jvmService = monitorService.jvmService();
    fsService = monitorService.fsService();
    this.httpStatsSupplier = httpStatsSupplier;
    this.boundHttpAddress = boundHttpAddress;
    this.threadPool = threadPool;
    this.extendedNodeInfo = extendedNodeInfo;
    this.psqlStats = psqlStats;
    this.boundPostgresAddress = boundPostgresAddress;
    this.numOpenTransportConnections = numOpenTransportConnections;
    this.clusterStateVersion = clusterStateVersion;
}
 
Example #3
Source Project: Elasticsearch   Author: baidu   File: FaultDetection.java    License: 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 #4
Source Project: Elasticsearch   Author: baidu   File: RecoveriesCollection.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void doRun() throws Exception {
    RecoveryStatus status = onGoingRecoveries.get(recoveryId);
    if (status == null) {
        logger.trace("[monitor] no status found for [{}], shutting down", recoveryId);
        return;
    }
    long accessTime = status.lastAccessTime();
    if (accessTime == lastSeenAccessTime) {
        String message = "no activity after [" + checkInterval + "]";
        failRecovery(recoveryId,
                new RecoveryFailedException(status.state(), message, new ElasticsearchTimeoutException(message)),
                true // to be safe, we don't know what go stuck
        );
        return;
    }
    lastSeenAccessTime = accessTime;
    logger.trace("[monitor] rescheduling check for [{}]. last access time is [{}]", recoveryId, lastSeenAccessTime);
    threadPool.schedule(checkInterval, ThreadPool.Names.GENERIC, this);
}
 
Example #5
Source Project: crate   Author: crate   File: TransportService.java    License: Apache License 2.0 6 votes vote down vote up
/**
    * Build the service.
    *
    * @param clusterSettings if non null, the {@linkplain TransportService} will register with the {@link ClusterSettings} for settings
*        updates for {@link TransportSettings#TRACE_LOG_EXCLUDE_SETTING} and {@link TransportSettings#TRACE_LOG_INCLUDE_SETTING}.
    */
   public TransportService(Settings settings,
                           Transport transport,
                           ThreadPool threadPool,
                           TransportInterceptor transportInterceptor,
                           Function<BoundTransportAddress, DiscoveryNode> localNodeFactory,
                           @Nullable ClusterSettings clusterSettings) {
       this(
           settings,
           transport,
           threadPool,
           transportInterceptor,
           localNodeFactory,
           clusterSettings,
           new ConnectionManager(settings, transport, threadPool)
       );
   }
 
Example #6
Source Project: crate   Author: crate   File: MockTransportService.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Build the service.
 *
 * @param clusterSettings if non null the {@linkplain TransportService} will register with the {@link ClusterSettings} for settings
 *                        updates for {@link TransportSettings#TRACE_LOG_EXCLUDE_SETTING} and {@link TransportSettings#TRACE_LOG_INCLUDE_SETTING}.
 */
public MockTransportService(Settings settings, Transport transport, ThreadPool threadPool, TransportInterceptor interceptor,
                            @Nullable ClusterSettings clusterSettings) {
    this(
        settings,
        transport,
        threadPool,
        interceptor,
        (boundAddress) -> DiscoveryNode.createLocal(
            settings,
            boundAddress.publishAddress(),
            settings.get(Node.NODE_NAME_SETTING.getKey(),
            UUIDs.randomBase64UUID())
        ),
        clusterSettings
    );
}
 
Example #7
Source Project: anomaly-detection   Author: opendistro-for-elasticsearch   File: MasterEventListenerTests.java    License: Apache License 2.0 6 votes vote down vote up
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    clusterService = mock(ClusterService.class);
    threadPool = mock(ThreadPool.class);
    hourlyCancellable = mock(Cancellable.class);
    dailyCancellable = mock(Cancellable.class);
    when(threadPool.scheduleWithFixedDelay(any(HourlyCron.class), any(TimeValue.class), any(String.class)))
        .thenReturn(hourlyCancellable);
    when(threadPool.scheduleWithFixedDelay(any(DailyCron.class), any(TimeValue.class), any(String.class))).thenReturn(dailyCancellable);
    client = mock(Client.class);
    clock = mock(Clock.class);
    clientUtil = mock(ClientUtil.class);
    HashMap<String, String> ignoredAttributes = new HashMap<String, String>();
    ignoredAttributes.put(CommonName.BOX_TYPE_KEY, CommonName.WARM_BOX_TYPE);
    nodeFilter = new DiscoveryNodeFilterer(clusterService);

    masterService = new MasterEventListener(clusterService, threadPool, client, clock, clientUtil, nodeFilter);
}
 
Example #8
Source Project: crate   Author: crate   File: TransportReplicationAction.java    License: Apache License 2.0 6 votes vote down vote up
protected void registerRequestHandlers(String actionName,
                                       TransportService transportService,
                                       Writeable.Reader<Request> reader,
                                       Writeable.Reader<ReplicaRequest> replicaRequestReader,
                                       String executor) {
    transportService.registerRequestHandler(actionName, reader, ThreadPool.Names.SAME, new OperationTransportHandler());
    transportService.registerRequestHandler(
        transportPrimaryAction, in -> new ConcreteShardRequest<>(in, reader), executor, new PrimaryOperationTransportHandler());
    // we must never reject on because of thread pool capacity on replicas
    transportService.registerRequestHandler(
        transportReplicaAction,
        in -> new ConcreteReplicaRequest<>(in, replicaRequestReader),
        executor,
        true,
        true,
        new ReplicaOperationTransportHandler());
}
 
Example #9
Source Project: crate   Author: crate   File: TransportUpgradeSettingsAction.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public TransportUpgradeSettingsAction(TransportService transportService,
                                      ClusterService clusterService,
                                      ThreadPool threadPool,
                                      MetaDataUpdateSettingsService updateSettingsService,
                                      IndexNameExpressionResolver indexNameExpressionResolver) {
    super(
        UpgradeSettingsAction.NAME,
        transportService,
        clusterService,
        threadPool,
        UpgradeSettingsRequest::new,
        indexNameExpressionResolver
    );
    this.updateSettingsService = updateSettingsService;
}
 
Example #10
Source Project: Elasticsearch   Author: baidu   File: TranslogConfig.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new TranslogConfig instance
 * @param shardId the shard ID this translog belongs to
 * @param translogPath the path to use for the transaction log files
 * @param indexSettings the index settings used to set internal variables
 * @param durabilty the default durability setting for the translog
 * @param bigArrays a bigArrays instance used for temporarily allocating write operations
 * @param threadPool a {@link ThreadPool} to schedule async sync durability
 */
public TranslogConfig(ShardId shardId, Path translogPath, Settings indexSettings, Translog.Durabilty durabilty, BigArrays bigArrays, @Nullable ThreadPool threadPool) {
    this.indexSettings = indexSettings;
    this.shardId = shardId;
    this.translogPath = translogPath;
    this.durabilty = durabilty;
    this.threadPool = threadPool;
    this.bigArrays = bigArrays;
    this.type = TranslogWriter.Type.fromString(indexSettings.get(INDEX_TRANSLOG_FS_TYPE, TranslogWriter.Type.BUFFERED.name()));
    this.bufferSize = (int) indexSettings.getAsBytesSize(INDEX_TRANSLOG_BUFFER_SIZE, IndexingMemoryController.INACTIVE_SHARD_TRANSLOG_BUFFER).bytes(); // Not really interesting, updated by IndexingMemoryController...

    syncInterval = indexSettings.getAsTime(INDEX_TRANSLOG_SYNC_INTERVAL, TimeValue.timeValueSeconds(5));
    if (syncInterval.millis() > 0 && threadPool != null) {
        syncOnEachOperation = false;
    } else if (syncInterval.millis() == 0) {
        syncOnEachOperation = true;
    } else {
        syncOnEachOperation = false;
    }
}
 
Example #11
Source Project: Elasticsearch   Author: baidu   File: MasterFaultDetection.java    License: Apache License 2.0 6 votes vote down vote up
private void innerStart(final DiscoveryNode masterNode) {
    this.masterNode = masterNode;
    this.retryCount = 0;
    this.notifiedMasterFailure.set(false);

    // try and connect to make sure we are connected
    try {
        transportService.connectToNode(masterNode);
    } catch (final Exception e) {
        // notify master failure (which stops also) and bail..
        notifyMasterFailure(masterNode, "failed to perform initial connect [" + e.getMessage() + "]");
        return;
    }
    if (masterPinger != null) {
        masterPinger.stop();
    }
    this.masterPinger = new MasterPinger();

    // we start pinging slightly later to allow the chosen master to complete it's own master election
    threadPool.schedule(pingInterval, ThreadPool.Names.SAME, masterPinger);
}
 
Example #12
Source Project: crate   Author: crate   File: PhasesTaskFactory.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public PhasesTaskFactory(ClusterService clusterService,
                         ThreadPool threadPool,
                         JobSetup jobSetup,
                         TasksService tasksService,
                         IndicesService indicesService,
                         TransportJobAction jobAction,
                         TransportKillJobsNodeAction killJobsNodeAction) {
    this.clusterService = clusterService;
    this.jobSetup = jobSetup;
    this.tasksService = tasksService;
    this.indicesService = indicesService;
    this.jobAction = jobAction;
    this.killJobsNodeAction = killJobsNodeAction;
    this.searchExecutor = threadPool.executor(ThreadPool.Names.SEARCH);
}
 
Example #13
Source Project: Elasticsearch   Author: baidu   File: GatewayService.java    License: Apache License 2.0 5 votes vote down vote up
private void performStateRecovery(boolean enforceRecoverAfterTime, String reason) {
    final Gateway.GatewayStateRecoveredListener recoveryListener = new GatewayRecoveryListener();

    if (enforceRecoverAfterTime && recoverAfterTime != null) {
        if (scheduledRecovery.compareAndSet(false, true)) {
            logger.info("delaying initial state recovery for [{}]. {}", recoverAfterTime, reason);
            threadPool.schedule(recoverAfterTime, ThreadPool.Names.GENERIC, new Runnable() {
                @Override
                public void run() {
                    if (recovered.compareAndSet(false, true)) {
                        logger.info("recover_after_time [{}] elapsed. performing state recovery...", recoverAfterTime);
                        gateway.performStateRecovery(recoveryListener);
                    }
                }
            });
        }
    } else {
        if (recovered.compareAndSet(false, true)) {
            threadPool.generic().execute(new AbstractRunnable() {
                @Override
                public void onFailure(Throwable t) {
                    logger.warn("Recovery failed", t);
                    // we reset `recovered` in the listener don't reset it here otherwise there might be a race
                    // that resets it to false while a new recover is already running?
                    recoveryListener.onFailure("state recovery failed: " + t.getMessage());
                }

                @Override
                protected void doRun() throws Exception {
                    gateway.performStateRecovery(recoveryListener);
                }
            });
        }
    }
}
 
Example #14
Source Project: Elasticsearch   Author: baidu   File: TransportDeleteAction.java    License: 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;
}
 
Example #15
Source Project: deprecated-security-advanced-modules   Author: opendistro-for-elasticsearch   File: OpenDistroSecurityRestApiActions.java    License: Apache License 2.0 5 votes vote down vote up
public static Collection<RestHandler> getHandler(Settings settings, Path configPath, RestController controller, Client client,
        AdminDNs adminDns, ConfigurationRepository cr, ClusterService cs, PrincipalExtractor principalExtractor, 
        final PrivilegesEvaluator evaluator, ThreadPool threadPool, AuditLog auditLog) {
    final List<RestHandler> handlers = new ArrayList<RestHandler>(9);
    handlers.add(new InternalUsersApiAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new RolesMappingApiAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new RolesApiAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new ActionGroupsApiAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new FlushCacheApiAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new OpenDistroSecurityConfigAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new PermissionsInfoAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new AuthTokenProcessorAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    handlers.add(new TenantsApiAction(settings, configPath, controller, client, adminDns, cr, cs, principalExtractor, evaluator, threadPool, auditLog));
    return Collections.unmodifiableCollection(handlers);
}
 
Example #16
Source Project: crate   Author: crate   File: IndicesClusterStateService.java    License: Apache License 2.0 5 votes vote down vote up
IndicesClusterStateService(Settings settings,
                           AllocatedIndices<? extends Shard, ? extends AllocatedIndex<? extends Shard>> indicesService,
                           ClusterService clusterService,
                           ThreadPool threadPool,
                           PeerRecoveryTargetService recoveryTargetService,
                           ShardStateAction shardStateAction,
                           NodeMappingRefreshAction nodeMappingRefreshAction,
                           RepositoriesService repositoriesService,
                           SyncedFlushService syncedFlushService,
                           PeerRecoverySourceService peerRecoverySourceService,
                           SnapshotShardsService snapshotShardsService,
                           PrimaryReplicaSyncer primaryReplicaSyncer,
                           Consumer<ShardId> globalCheckpointSyncer) {
    this.buildInIndexListener =
            Arrays.asList(
                    peerRecoverySourceService,
                    recoveryTargetService,
                    syncedFlushService,
                    snapshotShardsService);
    this.settings = settings;
    this.indicesService = indicesService;
    this.clusterService = clusterService;
    this.threadPool = threadPool;
    this.recoveryTargetService = recoveryTargetService;
    this.shardStateAction = shardStateAction;
    this.nodeMappingRefreshAction = nodeMappingRefreshAction;
    this.repositoriesService = repositoriesService;
    this.primaryReplicaSyncer = primaryReplicaSyncer;
    this.globalCheckpointSyncer = globalCheckpointSyncer;
    this.sendRefreshMapping = settings.getAsBoolean("indices.cluster.send_refresh_mapping", true);
}
 
Example #17
Source Project: crate   Author: crate   File: NetworkPlugin.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns a map of {@link Transport} suppliers.
 * See {@link org.elasticsearch.common.network.NetworkModule#TRANSPORT_TYPE_KEY} to configure a specific implementation.
 */
default Map<String, Supplier<Transport>> getTransports(Settings settings, ThreadPool threadPool, BigArrays bigArrays,
                                                       PageCacheRecycler pageCacheRecycler,
                                                       CircuitBreakerService circuitBreakerService,
                                                       NamedWriteableRegistry namedWriteableRegistry,
                                                       NetworkService networkService) {
    return Collections.emptyMap();
}
 
Example #18
Source Project: deprecated-security-advanced-modules   Author: opendistro-for-elasticsearch   File: AuthTokenProcessorAction.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public AuthTokenProcessorAction(final Settings settings, final Path configPath, final RestController controller,
		final Client client, final AdminDNs adminDNs, final ConfigurationRepository cl,
		final ClusterService cs, final PrincipalExtractor principalExtractor, final PrivilegesEvaluator evaluator,
		ThreadPool threadPool, AuditLog auditLog) {
	super(settings, configPath, controller, client, adminDNs, cl, cs, principalExtractor, evaluator, threadPool,
			auditLog);

	controller.registerHandler(Method.POST, "/_opendistro/_security/api/authtoken", this);
}
 
Example #19
Source Project: deprecated-security-advanced-modules   Author: opendistro-for-elasticsearch   File: AuditLogImpl.java    License: Apache License 2.0 5 votes vote down vote up
public AuditLogImpl(final Settings settings, final Path configPath, Client clientProvider, ThreadPool threadPool,
					final IndexNameExpressionResolver resolver, final ClusterService clusterService) {
	super(settings, threadPool, resolver, clusterService);

	this.messageRouter = new AuditMessageRouter(settings, clientProvider, threadPool, configPath);
	this.enabled = messageRouter.isEnabled();

	log.info("Message routing enabled: {}", this.enabled);

	final SecurityManager sm = System.getSecurityManager();

	if (sm != null) {
		log.debug("Security Manager present");
		sm.checkPermission(new SpecialPermission());
	}

	AccessController.doPrivileged(new PrivilegedAction<Object>() {
		@Override
		public Object run() {
			Runtime.getRuntime().addShutdownHook(new Thread() {

				@Override
				public void run() {
					try {
						close();
					} catch (final IOException e) {
						log.warn("Exception while shutting down message router", e);
					}
				}
			});
			log.debug("Shutdown Hook registered");
			return null;
		}
	});

}
 
Example #20
Source Project: BioSolr   Author: flaxsearch   File: OntologyMapper.java    License: Apache License 2.0 5 votes vote down vote up
public OntologyMapper(FieldMapper.Names names, FieldType fieldType, Boolean docValues,
		NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer,
		PostingsFormatProvider postingsFormat, DocValuesFormatProvider docValuesFormat,
		SimilarityProvider similarity, @Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, OntologySettings oSettings,
		Map<String, FieldMapper<String>> fieldMappers,
		ThreadPool threadPool) {
	super(names, 1f, fieldType, docValues, searchAnalyzer, indexAnalyzer, postingsFormat, docValuesFormat, similarity, null,
			fieldDataSettings, indexSettings, multiFields, null);
	this.ontologySettings = oSettings;
	// Mappers are added to mappers map as they are used/created
	this.mappers = UpdateInPlaceMap.of(MapperService.getFieldMappersCollectionSwitch(indexSettings));
	mappers.mutator().putAll(fieldMappers).close();
	this.threadPool = threadPool;
}
 
Example #21
Source Project: Elasticsearch   Author: baidu   File: TableStatsService.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public TableStatsService(Settings settings,
                         ThreadPool threadPool,
                         @StatsUpdateInterval TimeValue updateInterval,
                         Provider<TransportSQLAction> transportSQLAction) {
    super(settings);
    this.transportSQLAction = transportSQLAction;
    threadPool.scheduleWithFixedDelay(this, updateInterval);
}
 
Example #22
Source Project: Elasticsearch   Author: baidu   File: SearchDfsQueryAndFetchAsyncAction.java    License: Apache License 2.0 5 votes vote down vote up
SearchDfsQueryAndFetchAsyncAction(ESLogger logger, SearchServiceTransportAction searchService,
                                          ClusterService clusterService, IndexNameExpressionResolver indexNameExpressionResolver,
                                          SearchPhaseController searchPhaseController, ThreadPool threadPool,
                                          SearchRequest request, ActionListener<SearchResponse> listener) {
    super(logger, searchService, clusterService, indexNameExpressionResolver, searchPhaseController, threadPool, request, listener);
    queryFetchResults = new AtomicArray<>(firstResults.length());
}
 
Example #23
Source Project: crate   Author: crate   File: TransportRestoreSnapshotAction.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public TransportRestoreSnapshotAction(TransportService transportService,
                                      ClusterService clusterService,
                                      ThreadPool threadPool,
                                      RestoreService restoreService,
                                      IndexNameExpressionResolver indexNameExpressionResolver) {
    super(RestoreSnapshotAction.NAME, transportService, clusterService, threadPool, RestoreSnapshotRequest::new, indexNameExpressionResolver);
    this.restoreService = restoreService;
}
 
Example #24
Source Project: Elasticsearch   Author: baidu   File: TransportExistsAction.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public TransportExistsAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService,
                            IndicesService indicesService, ScriptService scriptService,
                            PageCacheRecycler pageCacheRecycler, BigArrays bigArrays, ActionFilters actionFilters,
                             IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, ExistsAction.NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver,
            ExistsRequest.class, ShardExistsRequest.class, ThreadPool.Names.SEARCH);
    this.indicesService = indicesService;
    this.scriptService = scriptService;
    this.pageCacheRecycler = pageCacheRecycler;
    this.bigArrays = bigArrays;
}
 
Example #25
Source Project: Elasticsearch   Author: baidu   File: TransportFlushAction.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public TransportFlushAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
                            TransportService transportService, ActionFilters actionFilters,
                            IndexNameExpressionResolver indexNameExpressionResolver,
                            TransportShardFlushAction replicatedFlushAction) {
    super(FlushAction.NAME, FlushRequest.class, settings, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver, replicatedFlushAction);
}
 
Example #26
Source Project: Elasticsearch   Author: baidu   File: SearchQueryAndFetchAsyncAction.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void moveToSecondPhase() throws Exception {
    threadPool.executor(ThreadPool.Names.SEARCH).execute(new ActionRunnable<SearchResponse>(listener) {
        @Override
        public void doRun() throws IOException {
            boolean useScroll = request.scroll() != null;
            sortedShardList = searchPhaseController.sortDocs(useScroll, firstResults);
            final InternalSearchResponse internalResponse = searchPhaseController.merge(sortedShardList, firstResults,
                firstResults, request);
            String scrollId = null;
            if (request.scroll() != null) {
                scrollId = TransportSearchHelper.buildScrollId(request.searchType(), firstResults, null);
            }
            listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successfulOps.get(),
                buildTookInMillis(), buildShardFailures()));
        }

        @Override
        public void onFailure(Throwable t) {
            ReduceSearchPhaseException failure = new ReduceSearchPhaseException("merge", "", t, buildShardFailures());
            if (logger.isDebugEnabled()) {
                logger.debug("failed to reduce search", failure);
            }
            super.onFailure(failure);
        }
    });
}
 
Example #27
Source Project: crate   Author: crate   File: BlobStoreRepositoryTest.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void createRepository() throws Exception {
    // BlobStoreRepository operations must run on specific threads
    Thread.currentThread().setName(ThreadPool.Names.GENERIC);
    defaultRepositoryLocation = TEMPORARY_FOLDER.newFolder();
    execute("CREATE REPOSITORY " + REPOSITORY_NAME + " TYPE \"fs\" with (location=?, compress=True)",
            new Object[]{defaultRepositoryLocation.getAbsolutePath()});
    assertThat(response.rowCount(), is(1L));
}
 
Example #28
Source Project: deprecated-security-ssl   Author: opendistro-for-elasticsearch   File: OpenDistroSecuritySSLRequestHandler.java    License: Apache License 2.0 5 votes vote down vote up
public OpenDistroSecuritySSLRequestHandler(String action, TransportRequestHandler<T> actualHandler, 
        ThreadPool threadPool, final PrincipalExtractor principalExtractor, final SslExceptionHandler errorHandler) {
    super();
    this.action = action;
    this.actualHandler = actualHandler;
    this.threadPool = threadPool;
    this.principalExtractor = principalExtractor;
    this.errorHandler = errorHandler;
}
 
Example #29
Source Project: Elasticsearch   Author: baidu   File: TransportMultiGetAction.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public TransportMultiGetAction(Settings settings, ThreadPool threadPool, TransportService transportService,
                               ClusterService clusterService, TransportShardMultiGetAction shardAction,
                               ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings, MultiGetAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, MultiGetRequest.class);
    this.clusterService = clusterService;
    this.shardAction = shardAction;
}
 
Example #30
Source Project: elasticsearch-reindexing   Author: codelibs   File: ReindexingService.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public ReindexingService(final Settings settings, final Client client,
                         final ThreadPool threadPool) {
    super(settings);
    this.client = client;
    this.threadPool = threadPool;
}