Class AbstractTaskNode<T>

java.lang.Object
org.jppf.node.protocol.AbstractTask<T>
org.jppf.node.protocol.graph.AbstractTaskNode<T>
Type Parameters:
T - the type of results returned by this task.
All Implemented Interfaces:
Serializable, Runnable, TaskNode<T>, Interruptibility, PositionalElement<Task<T>>, Task<T>

public class AbstractTaskNode<T> extends AbstractTask<T> implements TaskNode<T>
Instances of this class represent tasks that are part of a dependency graph of tasks within a job.
Dependencies can be added using the dependsOn(Collection<TaskNode>) and dependsOn(TaskNode...) methods.

Dependency cycles are checked and detected every time one or more dependencies are added to this task via the aforementioned methods. When a dependency cycle is detected, a JPPFDependencyCycleException is raised, with a description of the cycle.

It is therefore guaranteed that tasks with dependencies form a directed acyclic graph (DAG). This ensures that the tasks can be executed in a topological order where no task will be executed before its dependencies.

Since:
6.2
Author:
Laurent Cohen
See Also:
  • Constructor Details

    • AbstractTaskNode

      public AbstractTaskNode()
  • Method Details

    • dependsOn

      public TaskNode<T> dependsOn(Collection<TaskNode<?>> tasks) throws JPPFDependencyCycleException
      Description copied from interface: TaskNode
      Add a set of dependencies to this task.
      Specified by:
      dependsOn in interface TaskNode<T>
      Parameters:
      tasks - a collection of tasks that this task depends on.
      Returns:
      this task, for method call chaining.
      Throws:
      JPPFDependencyCycleException - if a cycle is detected in the graph of dependencies of this task.
    • getDependencies

      public Collection<TaskNode<?>> getDependencies()
      Description copied from interface: TaskNode
      Get the dependencies of this task, if any.
      Specified by:
      getDependencies in interface TaskNode<T>
      Returns:
      the dependencies as a collection of TaskGraph instances, or null if there is no dependency.
    • getDependants

      public Collection<TaskNode<?>> getDependants()
      Description copied from interface: TaskNode
      Get the tasks that depend on this task, if any.
      Specified by:
      getDependants in interface TaskNode<T>
      Returns:
      the dependants as a collection of Task instances, or null if there is no dependant.