Skip to content

Commit

Permalink
Use PersistentTasksService#waitForPersistentTaskStatus(...) to wait f…
Browse files Browse the repository at this point in the history
…or job and datafeed status and use PersistentTasksService#removeTask(...) to force close job and force stop datafeed.
  • Loading branch information
martijnvg committed Feb 5, 2018
1 parent f26674e commit b105020
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.ClusterStateObserver;
import org.elasticsearch.cluster.node.DiscoveryNode;
Expand All @@ -34,6 +33,7 @@
import org.elasticsearch.tasks.TaskId;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.persistent.PersistentTasksCustomMetaData.PersistentTask;
import org.elasticsearch.security.InternalClient;

import java.util.function.Predicate;

Expand All @@ -42,11 +42,11 @@
*/
public class PersistentTasksService extends AbstractComponent {

private final Client client;
private final InternalClient client;
private final ClusterService clusterService;
private final ThreadPool threadPool;

public PersistentTasksService(Settings settings, ClusterService clusterService, ThreadPool threadPool, Client client) {
public PersistentTasksService(Settings settings, ClusterService clusterService, ThreadPool threadPool, InternalClient client) {
super(settings);
this.client = client;
this.clusterService = clusterService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import org.elasticsearch.watcher.ResourceWatcherService;
import org.elasticsearch.persistent.PersistentTasksCustomMetaData.Assignment;
import org.elasticsearch.persistent.PersistentTasksService.PersistentTaskOperationListener;
import org.elasticsearch.security.InternalClient;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -104,7 +105,8 @@ public class TestPersistentTasksPlugin extends Plugin implements ActionPlugin {
public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
NamedXContentRegistry xContentRegistry) {
PersistentTasksService persistentTasksService = new PersistentTasksService(Settings.EMPTY, clusterService, threadPool, client);
InternalClient internalClient = new InternalClient(Settings.EMPTY, threadPool, client);
PersistentTasksService persistentTasksService = new PersistentTasksService(Settings.EMPTY, clusterService, threadPool, internalClient);
TestPersistentTasksExecutor testPersistentAction = new TestPersistentTasksExecutor(Settings.EMPTY, persistentTasksService,
clusterService);
PersistentTasksExecutorRegistry persistentTasksExecutorRegistry = new PersistentTasksExecutorRegistry(Settings.EMPTY,
Expand Down

0 comments on commit b105020

Please sign in to comment.