Simplify grouping of cluster state update tasks

This commit is contained in:
Jason Tedor 2015-11-24 12:10:38 -05:00
parent eaba3d5cb3
commit 1fb6a1f669
2 changed files with 2 additions and 12 deletions

View File

@ -104,12 +104,7 @@ public class MetaDataMappingService extends AbstractComponent {
if (task.index == null) {
logger.debug("ignoring a mapping task of type [{}] with a null index.", task);
}
List<RefreshTask> indexTasks = tasksPerIndex.get(task.index);
if (indexTasks == null) {
indexTasks = new ArrayList<>();
tasksPerIndex.put(task.index, indexTasks);
}
indexTasks.add(task);
tasksPerIndex.computeIfAbsent(task.index, k -> new ArrayList<>()).add(task);
}
boolean dirty = false;

View File

@ -286,12 +286,7 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
final UpdateTask<T> updateTask = new UpdateTask<>(source, task, config, executor, listener);
synchronized (updateTasksPerExecutor) {
List<UpdateTask> pendingTasks = updateTasksPerExecutor.get(executor);
if (pendingTasks == null) {
pendingTasks = new ArrayList<>();
updateTasksPerExecutor.put(executor, pendingTasks);
}
pendingTasks.add(updateTask);
updateTasksPerExecutor.computeIfAbsent(executor, k -> new ArrayList<>()).add(updateTask);
}
if (config.timeout() != null) {