Added more parameter to PersistentTaskPlugin#getPersistentTasksExecutor(...)

This commit is contained in:
Martijn van Groningen 2018-02-06 13:47:06 +01:00
parent c0886cf7c6
commit 2023c98bea
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
3 changed files with 7 additions and 8 deletions

View File

@ -468,7 +468,7 @@ public class Node implements Closeable {
final List<PersistentTasksExecutor<?>> tasksExecutors = pluginsService final List<PersistentTasksExecutor<?>> tasksExecutors = pluginsService
.filterPlugins(PersistentTaskPlugin.class).stream() .filterPlugins(PersistentTaskPlugin.class).stream()
.map(p -> p.getPersistentTasksExecutor(clusterService)) .map(p -> p.getPersistentTasksExecutor(clusterService, threadPool, client))
.flatMap(List::stream) .flatMap(List::stream)
.collect(toList()); .collect(toList());

View File

@ -18,8 +18,10 @@
*/ */
package org.elasticsearch.plugins; package org.elasticsearch.plugins;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.persistent.PersistentTasksExecutor; import org.elasticsearch.persistent.PersistentTasksExecutor;
import org.elasticsearch.threadpool.ThreadPool;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -32,7 +34,8 @@ public interface PersistentTaskPlugin {
/** /**
* Returns additional persistent tasks executors added by this plugin. * Returns additional persistent tasks executors added by this plugin.
*/ */
default List<PersistentTasksExecutor<?>> getPersistentTasksExecutor(ClusterService clusterService) { default List<PersistentTasksExecutor<?>> getPersistentTasksExecutor(ClusterService clusterService,
ThreadPool threadPool, Client client) {
return Collections.emptyList(); return Collections.emptyList();
} }

View File

@ -51,25 +51,20 @@ import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.NamedXContentRegistry; import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.env.Environment;
import org.elasticsearch.env.NodeEnvironment;
import org.elasticsearch.plugins.ActionPlugin; import org.elasticsearch.plugins.ActionPlugin;
import org.elasticsearch.plugins.PersistentTaskPlugin; import org.elasticsearch.plugins.PersistentTaskPlugin;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.ScriptService;
import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.Task;
import org.elasticsearch.tasks.TaskCancelledException; import org.elasticsearch.tasks.TaskCancelledException;
import org.elasticsearch.tasks.TaskId; import org.elasticsearch.tasks.TaskId;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService; import org.elasticsearch.transport.TransportService;
import org.elasticsearch.watcher.ResourceWatcherService;
import org.elasticsearch.persistent.PersistentTasksCustomMetaData.Assignment; import org.elasticsearch.persistent.PersistentTasksCustomMetaData.Assignment;
import org.elasticsearch.persistent.PersistentTasksCustomMetaData.PersistentTask; import org.elasticsearch.persistent.PersistentTasksCustomMetaData.PersistentTask;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -96,7 +91,8 @@ public class TestPersistentTasksPlugin extends Plugin implements ActionPlugin, P
} }
@Override @Override
public List<PersistentTasksExecutor<?>> getPersistentTasksExecutor(ClusterService clusterService) { public List<PersistentTasksExecutor<?>> getPersistentTasksExecutor(ClusterService clusterService,
ThreadPool threadPool, Client client) {
return Collections.singletonList(new TestPersistentTasksExecutor(Settings.EMPTY, clusterService)); return Collections.singletonList(new TestPersistentTasksExecutor(Settings.EMPTY, clusterService));
} }