From e0b6a1e4934bcec730fc87f13b775abc181e34a6 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Mon, 16 Jan 2017 10:22:34 +0100 Subject: [PATCH] Removed unneeded task (de)registering as the super class does this already Original commit: elastic/x-pack-elasticsearch@f5be371e83c84dd07bf63be68025a009dae7d905 --- .../java/org/elasticsearch/xpack/ml/MlPlugin.java | 5 +---- .../xpack/ml/action/DeleteJobAction.java | 13 ++----------- 2 files changed, 3 insertions(+), 15 deletions(-) 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