fixed forbidden usage of Guava's MoreExecutors in Watcher
Original commit: elastic/x-pack-elasticsearch@5b977f9ff3
This commit is contained in:
parent
55f77fd52d
commit
16ad2edc33
|
@ -152,7 +152,7 @@ public class WatcherIndexTemplateRegistry extends AbstractComponent implements C
|
|||
private void putTemplate(final TemplateConfig config, boolean wait) {
|
||||
final Executor executor;
|
||||
if (wait) {
|
||||
executor = MoreExecutors.directExecutor();
|
||||
executor = Runnable::run;
|
||||
} else {
|
||||
executor = threadPool.generic();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ import org.junit.Test;
|
|||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
|
@ -32,7 +34,7 @@ public class WatcherLifeCycleServiceTests extends ESTestCase {
|
|||
@Before
|
||||
public void prepareServices() {
|
||||
ThreadPool threadPool = mock(ThreadPool.class);
|
||||
when(threadPool.executor(anyString())).thenReturn(MoreExecutors.newDirectExecutorService());
|
||||
when(threadPool.executor(anyString())).thenReturn(Runnable::run);
|
||||
clusterService = mock(ClusterService.class);
|
||||
Answer<Object> answer = new Answer<Object>() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue