Class DAGNode<DataT,​NodeT extends DAGNode<DataT,​NodeT>>

  • Type Parameters:
    DataT - the type of the data stored in the node
    NodeT - the type of the node
    Direct Known Subclasses:
    TaskGroupEntry

    public class DAGNode<DataT,​NodeT extends DAGNode<DataT,​NodeT>>
    extends Node<DataT,​NodeT>
    The type representing node in a DAGraph.
    • Constructor Detail

      • DAGNode

        public DAGNode​(String key,
                       DataT data)
        Creates a DAG node.
        Parameters:
        key - unique id of the node
        data - data to be stored in the node
    • Method Detail

      • lock

        public ReentrantLock lock()
        Returns:
        the lock to be used while performing thread safe operation on this node.
      • addDependent

        public void addDependent​(String key)
        Mark the node identified by the given key as dependent of this node.
        Parameters:
        key - the id of the dependent node
      • dependencyKeys

        public List<String> dependencyKeys()
        Returns:
        a list of keys of nodes in DAGraph that this node depends on
      • addDependency

        public void addDependency​(String dependencyKey)
        Mark the node identified by the given key as this node's dependency.
        Parameters:
        dependencyKey - the id of the dependency node
      • removeDependency

        public void removeDependency​(String dependencyKey)
        Remove the dependency node identified by the given key from the dependencies.
        Parameters:
        dependencyKey - the id of the dependency node
      • hasDependencies

        public boolean hasDependencies()
        Returns:
        true if this node has any dependency
      • setPreparer

        public void setPreparer​(boolean isPreparer)
        Mark or un-mark this node as preparer.
        Parameters:
        isPreparer - true if this node needs to be marked as preparer, false otherwise.
      • isPreparer

        public boolean isPreparer()
        Returns:
        true if this node is marked as preparer
      • initialize

        public void initialize()
        Initialize the node so that traversal can be performed on the parent DAG.
      • onSuccessfulResolution

        protected void onSuccessfulResolution​(String dependencyKey)
        Reports a dependency of this node has been successfully resolved.
        Parameters:
        dependencyKey - the id of the dependency node
      • onFaultedResolution

        protected void onFaultedResolution​(String dependencyKey,
                                           Throwable throwable)
        Reports a dependency of this node has been faulted.
        Parameters:
        dependencyKey - the id of the dependency node
        throwable - the reason for unsuccessful resolution