|
@@ -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<T> extends AdapterActionFuture<T, T> 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 <T> the result of the future
|
|
|
- * @return a listenable future
|
|
|
- */
|
|
|
- public static <T> PlainListenableActionFuture<T> newDispatchingListenableFuture(ThreadPool threadPool) {
|
|
|
- return new DispatchingListenableActionFuture<>(threadPool);
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public void addListener(final ActionListener<T> listener) {
|
|
|
internalAddListener(listener);
|
|
@@ -121,18 +107,4 @@ public class PlainListenableActionFuture<T> extends AdapterActionFuture<T, T> im
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static final class DispatchingListenableActionFuture<T> extends PlainListenableActionFuture<T> {
|
|
|
-
|
|
|
- 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<T> listener) {
|
|
|
- super.addListener(new ThreadedActionListener<>(logger, threadPool, ThreadPool.Names.LISTENER, listener, false));
|
|
|
- }
|
|
|
- }
|
|
|
}
|