From 8b970d970ddfb32c27d51f436c4d6f7b35258540 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Sat, 2 Apr 2016 13:41:23 -0400 Subject: [PATCH] Clarify closing of timeout listeners --- .../org/elasticsearch/cluster/service/ClusterService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/cluster/service/ClusterService.java b/core/src/main/java/org/elasticsearch/cluster/service/ClusterService.java index d3fca22c165..00889fecafa 100644 --- a/core/src/main/java/org/elasticsearch/cluster/service/ClusterService.java +++ b/core/src/main/java/org/elasticsearch/cluster/service/ClusterService.java @@ -219,8 +219,12 @@ public class ClusterService extends AbstractLifecycleComponent { } } ThreadPool.terminate(updateTasksExecutor, 10, TimeUnit.SECONDS); - postAppliedListeners.stream().filter(listener -> listener instanceof TimeoutClusterStateListener) - .forEach(listener -> ((TimeoutClusterStateListener) listener).onClose()); + // close timeout listeners that did not have an ongoing timeout + postAppliedListeners + .stream() + .filter(listener -> listener instanceof TimeoutClusterStateListener) + .map(listener -> (TimeoutClusterStateListener)listener) + .forEach(TimeoutClusterStateListener::onClose); remove(localNodeMasterListeners); }