浏览代码

Use only Executor in ThreadedActionListener (#93956)

ThreadedActionListener only relies on methods provided by `Executor` but
required to pass an `ExecutorService`. With this commit we relax the
required type to what's actually needed.

Relates #93184
Daniel Mitterdorfer 2 年之前
父节点
当前提交
6f9d7929da
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      server/src/main/java/org/elasticsearch/action/support/ThreadedActionListener.java

+ 4 - 4
server/src/main/java/org/elasticsearch/action/support/ThreadedActionListener.java

@@ -14,7 +14,7 @@ import org.elasticsearch.action.ActionListener;
 import org.elasticsearch.action.ActionRunnable;
 import org.elasticsearch.common.util.concurrent.AbstractRunnable;
 
-import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executor;
 
 /**
  * An action listener that wraps another action listener and dispatches its completion to an executor.
@@ -23,14 +23,14 @@ public final class ThreadedActionListener<Response> extends ActionListener.Deleg
 
     private static final Logger logger = LogManager.getLogger(ThreadedActionListener.class);
 
-    private final ExecutorService executor;
+    private final Executor executor;
     private final boolean forceExecution;
 
-    public ThreadedActionListener(ExecutorService executor, ActionListener<Response> listener) {
+    public ThreadedActionListener(Executor executor, ActionListener<Response> listener) {
         this(executor, false, listener);
     }
 
-    public ThreadedActionListener(ExecutorService executor, boolean forceExecution, ActionListener<Response> listener) {
+    public ThreadedActionListener(Executor executor, boolean forceExecution, ActionListener<Response> listener) {
         super(listener);
         this.forceExecution = forceExecution;
         this.executor = executor;