Inline TaskManager#register
This commit is contained in:
parent
8078c205f9
commit
dcd394d83f
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue