// Have already visited this task - skip it
queue.remove(0);
continue;
}
TaskInternal task = node.getTask();
boolean filtered = !filter.isSatisfiedBy(task);
if (filtered) {
// Task is not required - skip it
queue.remove(0);
node.dependenciesProcessed();
node.doNotRequire();
continue;
}
if (visiting.add(node)) {
// Have not seen this task before - add its dependencies to the head of the queue and leave this
// task in the queue
Set<? extends Task> dependsOnTasks = context.getDependencies(task);
for (Task dependsOnTask : dependsOnTasks) {
TaskInfo targetNode = graph.addNode(dependsOnTask);
node.addDependencySuccessor(targetNode);
if (!visiting.contains(targetNode)) {
queue.add(0, targetNode);
}
}
for (Task finalizerTask : task.getFinalizedBy().getDependencies(task)) {
TaskInfo targetNode = graph.addNode(finalizerTask);
addFinalizerNode(node, targetNode);
if (!visiting.contains(targetNode)) {
queue.add(0, targetNode);
}
}
for (Task mustRunAfter : task.getMustRunAfter().getDependencies(task)) {
TaskInfo targetNode = graph.addNode(mustRunAfter);
node.addMustSuccessor(targetNode);
}
for (Task shouldRunAfter : task.getShouldRunAfter().getDependencies(task)) {
TaskInfo targetNode = graph.addNode(shouldRunAfter);
node.addShouldSuccessor(targetNode);
}
if (node.isRequired()) {
for (TaskInfo successor : node.getDependencySuccessors()) {