use of org.elasticsearch.threadpool.ThreadPool in project elasticsearch by elastic.
the class ActionModuleTests method testPluginCanRegisterAction.
public void testPluginCanRegisterAction() {
class FakeRequest extends ActionRequest {
@Override
public ActionRequestValidationException validate() {
return null;
}
}
class FakeTransportAction extends TransportAction<FakeRequest, ActionResponse> {
protected FakeTransportAction(Settings settings, String actionName, ThreadPool threadPool, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, TaskManager taskManager) {
super(settings, actionName, threadPool, actionFilters, indexNameExpressionResolver, taskManager);
}
@Override
protected void doExecute(FakeRequest request, ActionListener<ActionResponse> listener) {
}
}
class FakeAction extends GenericAction<FakeRequest, ActionResponse> {
protected FakeAction() {
super("fake");
}
@Override
public ActionResponse newResponse() {
return null;
}
}
FakeAction action = new FakeAction();
ActionPlugin registersFakeAction = new ActionPlugin() {
@Override
public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() {
return singletonList(new ActionHandler<>(action, FakeTransportAction.class));
}
};
assertThat(ActionModule.setupActions(singletonList(registersFakeAction)), hasEntry("fake", new ActionHandler<>(action, FakeTransportAction.class)));
}
use of org.elasticsearch.threadpool.ThreadPool in project elasticsearch by elastic.
the class ClusterStateHealthTests method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
clusterService = createClusterService(threadPool);
transportService = new TransportService(clusterService.getSettings(), new CapturingTransport(), threadPool, TransportService.NOOP_TRANSPORT_INTERCEPTOR, x -> clusterService.localNode(), null);
transportService.start();
transportService.acceptIncomingRequests();
}
use of org.elasticsearch.threadpool.ThreadPool in project elasticsearch by elastic.
the class DynamicMappingDisabledTests method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
Settings settings = Settings.builder().put(MapperService.INDEX_MAPPER_DYNAMIC_SETTING.getKey(), false).build();
clusterService = createClusterService(threadPool);
Transport transport = new MockTcpTransport(settings, threadPool, BigArrays.NON_RECYCLING_INSTANCE, new NoneCircuitBreakerService(), new NamedWriteableRegistry(Collections.emptyList()), new NetworkService(settings, Collections.emptyList()));
transportService = new TransportService(clusterService.getSettings(), transport, threadPool, TransportService.NOOP_TRANSPORT_INTERCEPTOR, x -> clusterService.localNode(), null);
IndicesService indicesService = getInstanceFromNode(IndicesService.class);
ShardStateAction shardStateAction = new ShardStateAction(settings, clusterService, transportService, null, null, threadPool);
ActionFilters actionFilters = new ActionFilters(Collections.emptySet());
IndexNameExpressionResolver indexNameExpressionResolver = new IndexNameExpressionResolver(settings);
AutoCreateIndex autoCreateIndex = new AutoCreateIndex(settings, new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS), indexNameExpressionResolver);
UpdateHelper updateHelper = new UpdateHelper(settings, null);
TransportShardBulkAction shardBulkAction = new TransportShardBulkAction(settings, transportService, clusterService, indicesService, threadPool, shardStateAction, null, updateHelper, actionFilters, indexNameExpressionResolver);
transportBulkAction = new TransportBulkAction(settings, threadPool, transportService, clusterService, null, shardBulkAction, null, actionFilters, indexNameExpressionResolver, autoCreateIndex, System::currentTimeMillis);
}
use of org.elasticsearch.threadpool.ThreadPool in project elasticsearch by elastic.
the class GlobalCheckpointSyncActionTests method setUp.
public void setUp() throws Exception {
super.setUp();
threadPool = new TestThreadPool(getClass().getName());
transport = new CapturingTransport();
clusterService = createClusterService(threadPool);
transportService = new TransportService(clusterService.getSettings(), transport, threadPool, TransportService.NOOP_TRANSPORT_INTERCEPTOR, boundAddress -> clusterService.localNode(), null);
transportService.start();
transportService.acceptIncomingRequests();
shardStateAction = new ShardStateAction(Settings.EMPTY, clusterService, transportService, null, null, threadPool);
}
use of org.elasticsearch.threadpool.ThreadPool in project crate by crate.
the class ThreadPools method newInstance.
public static ThreadPools newInstance(ThreadPool threadPool) {
ThreadPools threadPools = ThreadPools.newInstance();
for (ThreadPool.Info info : threadPool.info()) {
String name = info.getName();
ThreadPoolExecutor executor = (ThreadPoolExecutor) threadPool.executor(name);
threadPools.add(name, ThreadPoolExecutorContext.newInstance(executor));
}
return threadPools;
}
Aggregations