Simplify grouping of cluster state update tasks
This commit is contained in:
parent
eaba3d5cb3
commit
1fb6a1f669
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue