Simplify loop in InternalClusterService#runTasksForExecutor

This commit is contained in:
Jason Tedor 2015-11-25 14:31:17 -05:00
parent 7caee2fa4d
commit 9aa9447016
1 changed files with 2 additions and 3 deletions

View File

@ -368,11 +368,10 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
synchronized (updateTasksPerExecutor) {
List<UpdateTask> pending = updateTasksPerExecutor.remove(executor);
if (pending != null) {
for (Iterator<UpdateTask> iter = pending.iterator(); iter.hasNext(); ) {
UpdateTask task = iter.next();
for (UpdateTask<T> task : pending) {
if (task.processed.getAndSet(true) == false) {
logger.trace("will process [{}]", task.source);
toExecute.add((UpdateTask<T>) task);
toExecute.add(task);
sources.add(task.source);
} else {
logger.trace("skipping [{}], already processed", task.source);