@Override
@SuppressWarnings("unchecked")
public List<ListenableFuture<TaskResult>> execute(Job job) {
assert job.tasks().size() > 0;
Task lastTask = null;
for (Task task : job.tasks()) {
// chaining tasks
if (lastTask != null) {
task.upstreamResult(lastTask.result());
}
task.start();
lastTask = task;
}
assert lastTask != null;
return (List<ListenableFuture<TaskResult>>)lastTask.result();
}