From 543319f966c3f34446dd762e64ae89cede4667b5 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Tue, 4 Apr 2017 16:09:54 +0200 Subject: [PATCH] [ML] Small cleanup Original commit: elastic/x-pack-elasticsearch@78a99258dddc0ade30beb55a8ce99bb39e2d91d4 --- .../elasticsearch/xpack/ml/datafeed/DatafeedManager.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManager.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManager.java index 6c07277b0f9..e1d18b88527 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManager.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManager.java @@ -32,7 +32,6 @@ import org.elasticsearch.xpack.ml.job.process.autodetect.state.DataCounts; import org.elasticsearch.xpack.ml.job.results.Bucket; import org.elasticsearch.xpack.ml.job.results.Result; import org.elasticsearch.xpack.ml.notifications.Auditor; -import org.elasticsearch.xpack.persistent.PersistentTasksCustomMetaData.PersistentTask; import org.elasticsearch.xpack.persistent.PersistentTasksService; import org.elasticsearch.xpack.persistent.PersistentTasksService.PersistentTaskOperationListener; @@ -47,7 +46,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; import java.util.function.BiConsumer; import java.util.function.Consumer; -import java.util.function.Predicate; import java.util.function.Supplier; import static org.elasticsearch.xpack.persistent.PersistentTasksService.WaitForPersistentTaskStatusListener; @@ -360,10 +358,7 @@ public class DatafeedManager extends AbstractComponent { } private void closeJob() { - Predicate> predicate = persistentTask -> { - return persistentTask == null || persistentTask.getStatus() == DatafeedState.STOPPED; - }; - persistentTasksService.waitForPersistentTaskStatus(taskId, predicate, TimeValue.timeValueSeconds(20), + persistentTasksService.waitForPersistentTaskStatus(taskId, Objects::isNull, TimeValue.timeValueSeconds(20), new WaitForPersistentTaskStatusListener() { @Override public void onResponse(long taskId) {