From 79b67eb3baa4bba8575b5763a6171571ddfbcb1e Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Sun, 8 Mar 2020 12:34:59 -0400 Subject: [PATCH] Drop action future that forks on listener executor (#53261) This commit drops the dispatching listenable action future that forks to the listener thread pool. This was previously used in the transport client but is no longer used. --- .../support/PlainListenableActionFuture.java | 28 ------------------- .../support/ListenableActionFutureTests.java | 7 +---- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/action/support/PlainListenableActionFuture.java b/server/src/main/java/org/elasticsearch/action/support/PlainListenableActionFuture.java index d99f2e620c1..efefbba87f1 100644 --- a/server/src/main/java/org/elasticsearch/action/support/PlainListenableActionFuture.java +++ b/server/src/main/java/org/elasticsearch/action/support/PlainListenableActionFuture.java @@ -19,11 +19,8 @@ package org.elasticsearch.action.support; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ListenableActionFuture; -import org.elasticsearch.threadpool.ThreadPool; import java.util.ArrayList; import java.util.List; @@ -46,17 +43,6 @@ public class PlainListenableActionFuture extends AdapterActionFuture im return new PlainListenableActionFuture<>(); } - /** - * This method returns a listenable future. The listeners will be called on completion of the future. - * The listeners will be executed on the LISTENER thread pool. - * @param threadPool the thread pool used to execute listeners - * @param the result of the future - * @return a listenable future - */ - public static PlainListenableActionFuture newDispatchingListenableFuture(ThreadPool threadPool) { - return new DispatchingListenableActionFuture<>(threadPool); - } - @Override public void addListener(final ActionListener listener) { internalAddListener(listener); @@ -121,18 +107,4 @@ public class PlainListenableActionFuture extends AdapterActionFuture im } } - private static final class DispatchingListenableActionFuture extends PlainListenableActionFuture { - - private static final Logger logger = LogManager.getLogger(DispatchingListenableActionFuture.class); - private final ThreadPool threadPool; - - private DispatchingListenableActionFuture(ThreadPool threadPool) { - this.threadPool = threadPool; - } - - @Override - public void addListener(final ActionListener listener) { - super.addListener(new ThreadedActionListener<>(logger, threadPool, ThreadPool.Names.LISTENER, listener, false)); - } - } } diff --git a/server/src/test/java/org/elasticsearch/action/support/ListenableActionFutureTests.java b/server/src/test/java/org/elasticsearch/action/support/ListenableActionFutureTests.java index 0dbf4603450..baa72c29b4d 100644 --- a/server/src/test/java/org/elasticsearch/action/support/ListenableActionFutureTests.java +++ b/server/src/test/java/org/elasticsearch/action/support/ListenableActionFutureTests.java @@ -34,12 +34,7 @@ public class ListenableActionFutureTests extends ESTestCase { public void testListenerIsCallableFromNetworkThreads() throws Throwable { ThreadPool threadPool = new TestThreadPool("testListenerIsCallableFromNetworkThreads"); try { - final PlainListenableActionFuture future; - if (randomBoolean()) { - future = PlainListenableActionFuture.newDispatchingListenableFuture(threadPool); - } else { - future = PlainListenableActionFuture.newListenableFuture(); - } + final PlainListenableActionFuture future = PlainListenableActionFuture.newListenableFuture(); final CountDownLatch listenerCalled = new CountDownLatch(1); final AtomicReference error = new AtomicReference<>(); final Object response = new Object();