diff --git a/watcher/src/main/java/org/elasticsearch/watcher/support/WatcherIndexTemplateRegistry.java b/watcher/src/main/java/org/elasticsearch/watcher/support/WatcherIndexTemplateRegistry.java index 0afc63f2cbe..fc4612b352a 100644 --- a/watcher/src/main/java/org/elasticsearch/watcher/support/WatcherIndexTemplateRegistry.java +++ b/watcher/src/main/java/org/elasticsearch/watcher/support/WatcherIndexTemplateRegistry.java @@ -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(); } diff --git a/watcher/src/test/java/org/elasticsearch/watcher/WatcherLifeCycleServiceTests.java b/watcher/src/test/java/org/elasticsearch/watcher/WatcherLifeCycleServiceTests.java index ed66e2a49ed..ec44247fb26 100644 --- a/watcher/src/test/java/org/elasticsearch/watcher/WatcherLifeCycleServiceTests.java +++ b/watcher/src/test/java/org/elasticsearch/watcher/WatcherLifeCycleServiceTests.java @@ -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 answer = new Answer() { @Override