public class DefaultDexecutorState<T,R> extends Object implements DexecutorState<T,R>
| Constructor and Description |
|---|
DefaultDexecutorState() |
| 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 evalFirstValue,
T evalAfterValue)
Should add the two nodes in the datastructure in such a way that
evalFirstValue should be evaluated before evalAfterValue. |
void |
addErrored(ExecutionResult<T,R> task)
Add to errored collection
|
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 |
decrementUnProcessedNodesCount()
decrements the count of total number of unprocessed nodes
|
int |
erroredCount() |
void |
forcedStop()
called to force stop
|
Phase |
getCurrentPhase() |
Collection<Node<T,R>> |
getDiscontinuedNodes() |
ExecutionResults<T,R> |
getErrored() |
Node<T,R> |
getGraphNode(T id)
Returns the node with the given id
|
Set<Node<T,R>> |
getInitialNodes()
Returns the Set of nodes for which there is no incoming dependencies.
|
Set<Node<T,R>> |
getNonProcessedRootNodes() |
Collection<Node<T,R>> |
getProcessedNodes() |
int |
getUnProcessedNodesCount() |
int |
graphSize()
Returns the total number of nodes in this graph
|
void |
incrementUnProcessedNodesCount()
increments the count of total number of unprocessed nodes
|
boolean |
isDiscontinuedNodesNotEmpty() |
void |
markDiscontinuedNodesProcessed()
clear (or marks) all the discontinued nodes till this point as processed
|
void |
markProcessingDone(Node<T,R> node) |
void |
onRecover()
called where Dexecutor is Recovered
|
void |
onTerminate()
called when Dexecutor is finished execution
|
void |
print(Traversar<T,R> traversar,
TraversarAction<T,R> action)
Prints the graph into the writer using the Traversar
|
void |
processAfterNoError(Collection<Node<T,R>> nodes)
Add to existing collection of discontinued nodes to be processed later, if system come to valid state.
|
void |
removeErrored(ExecutionResult<T,R> task)
Remove errored collection
|
void |
setCurrentPhase(Phase currentPhase)
sets the phase to that of provided
|
boolean |
shouldProcess(Node<T,R> node) |
void |
validate(Validator<T,R> validator)
validates the graph using the validator
|
public void addIndependent(T nodeValue)
DependencyAwareaddIndependent in interface DependencyAware<T>nodeValue - Unique node idpublic void addDependency(T evalFirstValue, T evalAfterValue)
DependencyAwareevalFirstValue should be evaluated before evalAfterValue.
Nodes should be created only if it is not already added.addDependency in interface DependencyAware<T>evalFirstValue - Node which should be evaluated firstevalAfterValue - Node which should be evaluated after evalFirstValuepublic void addAsDependentOnAllLeafNodes(T nodeValue)
DependencyAwareaddAsDependentOnAllLeafNodes in interface DependencyAware<T>nodeValue - Node which should depend on all leaf nodespublic void addAsDependencyToAllInitialNodes(T nodeValue)
DependencyAwareaddAsDependencyToAllInitialNodes in interface DependencyAware<T>nodeValue - Node on which all initial nodes should depends onpublic void setCurrentPhase(Phase currentPhase)
DexecutorStatesetCurrentPhase in interface DexecutorState<T,R>currentPhase - the phase that should be set topublic Phase getCurrentPhase()
getCurrentPhase in interface DexecutorState<T,R>public Set<Node<T,R>> getInitialNodes()
DexecutorStategetInitialNodes in interface DexecutorState<T,R>public Set<Node<T,R>> getNonProcessedRootNodes()
getNonProcessedRootNodes in interface DexecutorState<T,R>public int graphSize()
DexecutorStategraphSize in interface DexecutorState<T,R>public Node<T,R> getGraphNode(T id)
DexecutorStategetGraphNode in interface DexecutorState<T,R>id - The Unique node idpublic void incrementUnProcessedNodesCount()
DexecutorStateincrementUnProcessedNodesCount in interface DexecutorState<T,R>public void decrementUnProcessedNodesCount()
DexecutorStatedecrementUnProcessedNodesCount in interface DexecutorState<T,R>public int getUnProcessedNodesCount()
getUnProcessedNodesCount in interface DexecutorState<T,R>public boolean shouldProcess(Node<T,R> node)
shouldProcess in interface DexecutorState<T,R>node - on which test should happennode should be processed by dexecutor or notpublic void markProcessingDone(Node<T,R> node)
markProcessingDone in interface DexecutorState<T,R>node - Mark the node as processed.public Collection<Node<T,R>> getProcessedNodes()
getProcessedNodes in interface DexecutorState<T,R>public boolean isDiscontinuedNodesNotEmpty()
isDiscontinuedNodesNotEmpty in interface DexecutorState<T,R>true if there nodes that should be processed, if some were discontinued due to error.
false otherwisepublic Collection<Node<T,R>> getDiscontinuedNodes()
getDiscontinuedNodes in interface DexecutorState<T,R>public void markDiscontinuedNodesProcessed()
DexecutorStatemarkDiscontinuedNodesProcessed in interface DexecutorState<T,R>public void processAfterNoError(Collection<Node<T,R>> nodes)
DexecutorStateprocessAfterNoError in interface DexecutorState<T,R>nodes - which should be processed after retry successpublic void print(Traversar<T,R> traversar, TraversarAction<T,R> action)
DexecutorStateprint in interface DexecutorState<T,R>traversar - would traverse the graphaction - callback which would be called based on traversepublic void validate(Validator<T,R> validator)
DexecutorStatevalidate in interface DexecutorState<T,R>validator - based on which validation would happenpublic void addErrored(ExecutionResult<T,R> task)
DexecutorStateaddErrored in interface DexecutorState<T,R>task - to add to errored collectionpublic void removeErrored(ExecutionResult<T,R> task)
DexecutorStateremoveErrored in interface DexecutorState<T,R>task - to remove from errored collectionpublic int erroredCount()
erroredCount in interface DexecutorState<T,R>public ExecutionResults<T,R> getErrored()
getErrored in interface DexecutorState<T,R>public void forcedStop()
DexecutorStateforcedStop in interface DexecutorState<T,R>public void onTerminate()
DexecutorStateonTerminate in interface DexecutorState<T,R>public void onRecover()
DexecutorStateonRecover in interface DexecutorState<T,R>Copyright © 2016–2018 Dexecutor. All rights reserved.