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;
}
use of org.elasticsearch.threadpool.ThreadPool in project crate by crate.
the class NodeDisconnectJobMonitorServiceTest method testOnNodeDisconnectedKillsJobOriginatingFromThatNode.
@Test
public void testOnNodeDisconnectedKillsJobOriginatingFromThatNode() throws Exception {
JobContextService jobContextService = jobContextService();
JobExecutionContext.Builder builder = jobContextService.newBuilder(UUID.randomUUID());
builder.addSubContext(new DummySubContext());
JobExecutionContext context = jobContextService.createContext(builder);
ThreadPool threadPool = mock(ThreadPool.class);
when(threadPool.schedule(any(TimeValue.class), anyString(), any(Runnable.class))).thenAnswer((Answer<Object>) invocation -> {
((Runnable) invocation.getArguments()[2]).run();
return null;
});
NodeDisconnectJobMonitorService monitorService = new NodeDisconnectJobMonitorService(Settings.EMPTY, threadPool, jobContextService, mock(TransportService.class), mock(TransportKillJobsNodeAction.class));
monitorService.onNodeDisconnected(new DiscoveryNode("noop_id", DummyTransportAddress.INSTANCE, Version.CURRENT));
expectedException.expect(ContextMissingException.class);
jobContextService.getContext(context.jobId());
}
Aggregations