From 9aa9447016755884836c33909ec720cb79324247 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Wed, 25 Nov 2015 14:31:17 -0500 Subject: [PATCH] Simplify loop in InternalClusterService#runTasksForExecutor --- .../cluster/service/InternalClusterService.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java b/core/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java index ad4139fec21..a00b56f5775 100644 --- a/core/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java +++ b/core/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java @@ -368,11 +368,10 @@ public class InternalClusterService extends AbstractLifecycleComponent pending = updateTasksPerExecutor.remove(executor); if (pending != null) { - for (Iterator iter = pending.iterator(); iter.hasNext(); ) { - UpdateTask task = iter.next(); + for (UpdateTask task : pending) { if (task.processed.getAndSet(true) == false) { logger.trace("will process [{}]", task.source); - toExecute.add((UpdateTask) task); + toExecute.add(task); sources.add(task.source); } else { logger.trace("skipping [{}], already processed", task.source);