T
- Type of Node/Task IDR
- Type of Node/Task resultpublic class DefaultDexecutor<T extends Comparable<T>,R> extends Object implements Dexecutor<T,R>
Constructor and Description |
---|
DefaultDexecutor(DexecutorConfig<T,R> config)
Creates the Executor with Config
|
Modifier and Type | Method and Description |
---|---|
void |
addAsDependencyToAllInitialNodes(T nodeValue)
Adds the node as dependency to all initial nodes (at the time of adding), meaning this given node would be evaluated first and then all initial nodes would run in parallel
|
void |
addAsDependentOnAllLeafNodes(T nodeValue)
Adds the node as dependent on all leaf nodes (at the time of adding), meaning all leaf nodes would be evaluated first and then the given node
|
void |
addDependency(T evalFirstNode,
T evalLaterNode)
Should add the two nodes in the datastructure in such a way that
evalFirstValue should be evaluated before evalAfterValue . |
void |
addIndependent(T nodeValue)
Adds the given node to the datastructure whith out any dependency
Nodes should be created only if it is not already added.
|
void |
execute(ExecutionConfig config)
Kicks off the execution of the nodes based on the dependency graph constructed, using
addDepen*** apis |
void |
print(Traversar<T,R> traversar,
TraversarAction<T,R> action)
Prints the graph into the writer, using the traversar
|
void |
recoverExecution(ExecutionConfig config)
After a dexecutor crash, create a new instance of dexecutor and call this method for recovery
|
protected boolean |
shouldContinueProcessingNodes()
Override this method if force stop is required
|
public DefaultDexecutor(DexecutorConfig<T,R> config)
config
- based on which dexecutor would be constructedpublic void print(Traversar<T,R> traversar, TraversarAction<T,R> action)
Dexecutor
public void addIndependent(T nodeValue)
DependencyAware
addIndependent
in interface DependencyAware<T extends Comparable<T>>
nodeValue
- Unique node idpublic void addDependency(T evalFirstNode, T evalLaterNode)
DependencyAware
evalFirstValue
should be evaluated before evalAfterValue
.
Nodes should be created only if it is not already added.addDependency
in interface DependencyAware<T extends Comparable<T>>
evalFirstNode
- Node which should be evaluated firstevalLaterNode
- Node which should be evaluated after evalFirstValue
public void addAsDependentOnAllLeafNodes(T nodeValue)
DependencyAware
addAsDependentOnAllLeafNodes
in interface DependencyAware<T extends Comparable<T>>
nodeValue
- Node which should depend on all leaf nodespublic void addAsDependencyToAllInitialNodes(T nodeValue)
DependencyAware
addAsDependencyToAllInitialNodes
in interface DependencyAware<T extends Comparable<T>>
nodeValue
- Node on which all initial nodes should depends onpublic void recoverExecution(ExecutionConfig config)
Dexecutor
recoverExecution
in interface Dexecutor<T extends Comparable<T>,R>
config
- based on which execution would recoverpublic void execute(ExecutionConfig config)
Dexecutor
addDepen***
apisprotected boolean shouldContinueProcessingNodes()
true
if processing should continue otherwise false
Copyright © 2016 Dexecutor. All rights reserved.