Inline TaskManager#register

This commit is contained in:
Jason Tedor 2016-06-21 15:39:55 -04:00
parent 8078c205f9
commit dcd394d83f
1 changed files with 21 additions and 17 deletions

View File

@ -92,6 +92,15 @@ public class TaskManager extends AbstractComponent implements ClusterStateListen
}
if (task instanceof CancellableTask) {
registerCancellableTask(task);
} else {
Task previousTask = tasks.put(task.getId(), task);
assert previousTask == null;
}
return task;
}
private void registerCancellableTask(Task task) {
CancellableTask cancellableTask = (CancellableTask) task;
CancellableTaskHolder holder = new CancellableTaskHolder(cancellableTask);
CancellableTaskHolder oldHolder = cancellableTasks.put(task.getId(), holder);
@ -109,11 +118,6 @@ public class TaskManager extends AbstractComponent implements ClusterStateListen
}
}
}
} else {
Task previousTask = tasks.put(task.getId(), task);
assert previousTask == null;
}
return task;
}
/**