diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/MlPlugin.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/MlPlugin.java index 1ea072aedbf..a706344198f 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/MlPlugin.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/MlPlugin.java @@ -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 ); } diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteJobAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteJobAction.java index 8403c33812a..b6da14ec03d 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteJobAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/DeleteJobAction.java @@ -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 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