@Test void schedule() { ThreadPool threadPool = mock(ThreadPool.class); when(nodeClient.threadPool()).thenReturn(threadPool); doAnswer( invocation -> { Runnable task = invocation.getArgument(0); task.run(); return null; }) .when(threadPool) .schedule(any(), any(), any()); ElasticsearchNodeClient client = new ElasticsearchNodeClient(mock(ClusterService.class), nodeClient); AtomicBoolean isRun = new AtomicBoolean(false); client.schedule(() -> isRun.set(true)); assertTrue(isRun.get()); }
@Override public void schedule(Runnable task) { ThreadPool threadPool = client.threadPool(); threadPool.schedule( withCurrentContext(task), new TimeValue(0), SQL_WORKER_THREAD_POOL_NAME ); }
ElasticsearchNodeClient implements ElasticsearchClient { @Override public void schedule(Runnable task) { ThreadPool threadPool = client.threadPool(); threadPool.schedule( withCurrentContext(task), new TimeValue(0), SQL_WORKER_THREAD_POOL_NAME ); } }
ElasticsearchNodeClient implements ElasticsearchClient { @Override public void schedule(Runnable task) { ThreadPool threadPool = client.threadPool(); threadPool.schedule( withCurrentContext(task), new TimeValue(0), SQL_WORKER_THREAD_POOL_NAME ); }  }
ElasticsearchNodeClient implements ElasticsearchClient { @Override public void schedule(Runnable task) { ThreadPool threadPool = client.threadPool(); threadPool.schedule( withCurrentContext(task), new TimeValue(0), SQL_WORKER_THREAD_POOL_NAME ); }  @Override Map<String, IndexMapping> getIndexMappings(String indexExpression); @Override ElasticsearchResponse search(ElasticsearchRequest request); @Override void cleanup(ElasticsearchRequest request); @Override void schedule(Runnable task); }
ElasticsearchNodeClient implements ElasticsearchClient { @Override public void schedule(Runnable task) { ThreadPool threadPool = client.threadPool(); threadPool.schedule( withCurrentContext(task), new TimeValue(0), SQL_WORKER_THREAD_POOL_NAME ); }  @Override Map<String, IndexMapping> getIndexMappings(String indexExpression); @Override ElasticsearchResponse search(ElasticsearchRequest request); @Override void cleanup(ElasticsearchRequest request); @Override void schedule(Runnable task); static final String[] ALL_TYPES; static final Function<String, Predicate<String>> ALL_FIELDS; }