Package org.jppf.node.protocol.graph
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>
Instances of this class represent tasks that are part of a dependency graph of tasks within a job.
Dependencies can be added using the
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondependsOn(Collection<TaskNode<?>> tasks) Add a set of dependencies to this task.Collection<TaskNode<?>>Get the tasks that depend on this task, if any.Collection<TaskNode<?>>Get the dependencies of this task, if any.Methods inherited from class org.jppf.node.protocol.AbstractTask
compute, fireNotification, getDataProvider, getId, getJob, getMaxResubmits, getNode, getPosition, getResult, getTaskClassLoader, getTaskObject, getThrowable, getTimeoutSchedule, isInNode, isInterruptible, isResubmit, onCancel, onTimeout, run, setDataProvider, setExecutionDispatcher, setId, setInNode, setJob, setMaxResubmits, setNode, setPosition, setResubmit, setResult, setThrowable, setTimeoutScheduleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jppf.node.protocol.Interruptibility
isInterruptibleMethods inherited from interface org.jppf.node.protocol.PositionalElement
getPosition, setPositionMethods inherited from interface org.jppf.node.protocol.Task
compute, fireNotification, getDataProvider, getId, getJob, getMaxResubmits, getNode, getResult, getTaskClassLoader, getTaskObject, getThrowable, getTimeoutSchedule, isInNode, isResubmit, onCancel, onTimeout, setDataProvider, setId, setInNode, setJob, setMaxResubmits, setNode, setResubmit, setResult, setThrowable, setTimeoutScheduleMethods inherited from interface org.jppf.node.protocol.graph.TaskNode
dependsOn, hasDependant, hasDependency
-
Constructor Details
-
AbstractTaskNode
public AbstractTaskNode()
-
-
Method Details
-
dependsOn
Description copied from interface:TaskNodeAdd a set of dependencies to this task.- Specified by:
dependsOnin interfaceTaskNode<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
Description copied from interface:TaskNodeGet the dependencies of this task, if any.- Specified by:
getDependenciesin interfaceTaskNode<T>- Returns:
- the dependencies as a collection of
TaskGraphinstances, ornullif there is no dependency.
-
getDependants
Description copied from interface:TaskNodeGet the tasks that depend on this task, if any.- Specified by:
getDependantsin interfaceTaskNode<T>- Returns:
- the dependants as a collection of
Taskinstances, ornullif there is no dependant.
-