Removed unneeded task (de)registering as the super class does this already

Original commit: elastic/x-pack-elasticsearch@f5be371e83
This commit is contained in:
Martijn van Groningen 2017-01-16 10:22:34 +01:00
parent 5cd79f20fa
commit e0b6a1e493
2 changed files with 3 additions and 15 deletions

View File

@ -23,7 +23,6 @@ import org.elasticsearch.plugins.ActionPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.rest.RestHandler;
import org.elasticsearch.script.ScriptService;
import org.elasticsearch.tasks.TaskManager;
import org.elasticsearch.threadpool.ExecutorBuilder;
import org.elasticsearch.threadpool.FixedExecutorBuilder;
import org.elasticsearch.threadpool.ThreadPool;
@ -202,7 +201,6 @@ public class MlPlugin extends Plugin implements ActionPlugin {
autodetectProcessFactory, normalizerFactory);
ScheduledJobRunner scheduledJobRunner = new ScheduledJobRunner(threadPool, client, clusterService, jobProvider,
System::currentTimeMillis);
TaskManager taskManager = new TaskManager(settings);
JobLifeCycleService jobLifeCycleService =
new JobLifeCycleService(settings, client, clusterService, dataProcessor, threadPool.generic());
@ -227,8 +225,7 @@ public class MlPlugin extends Plugin implements ActionPlugin {
dataProcessor,
new MlInitializationService(settings, threadPool, clusterService, jobProvider),
jobDataCountsPersister,
scheduledJobRunner,
taskManager
scheduledJobRunner
);
}

View File

@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.tasks.TaskId;
import org.elasticsearch.tasks.TaskManager;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xpack.ml.job.Job;
@ -145,17 +144,15 @@ public class DeleteJobAction extends Action<DeleteJobAction.Request, DeleteJobAc
private final JobManager jobManager;
private final Client client;
private final TaskManager taskManager;
@Inject
public TransportAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool,
ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, JobManager jobManager,
Client client, TaskManager taskManager) {
Client client) {
super(settings, DeleteJobAction.NAME, transportService, clusterService, threadPool, actionFilters,
indexNameExpressionResolver, Request::new);
this.jobManager = jobManager;
this.client = client;
this.taskManager = taskManager;
}
@Override
@ -170,13 +167,7 @@ public class DeleteJobAction extends Action<DeleteJobAction.Request, DeleteJobAc
@Override
protected void masterOperation(Task task, Request request, ClusterState state, ActionListener<Response> listener) throws Exception {
jobManager.deleteJob(client, request, ActionListener.wrap(response -> {
taskManager.unregister(task);
listener.onResponse(response);
}, e -> {
taskManager.unregister(task);
listener.onFailure(e);
}));
jobManager.deleteJob(client, request, listener);
}
@Override