Class StandardChunkVisitor
- java.lang.Object
-
- org.jenkinsci.plugins.workflow.graphanalysis.StandardChunkVisitor
-
- All Implemented Interfaces:
SimpleChunkVisitor
public class StandardChunkVisitor extends Object implements SimpleChunkVisitor
Simple handler for linearFlowChunk
s (basic stages, etc), and designed to be extended. Note: only tracks one chunk at a time, so it won't handle nesting or parallels. Specifically, it will reset with each chunk start. ExtendhandleChunkDone(MemoryFlowChunk)
to gather up final chunks. ExtendatomNode(FlowNode, FlowNode, FlowNode, ForkScanner)
to gather data about nodes in a chunk.- Author:
- Sam Van Oort
-
-
Field Summary
Fields Modifier and Type Field Description protected MemoryFlowChunk
chunk
-
Constructor Summary
Constructors Constructor Description StandardChunkVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
atomNode(FlowNode before, FlowNode atomNode, FlowNode after, ForkScanner scan)
Extend me to do something with nodes inside a chunkvoid
chunkEnd(FlowNode endNode, FlowNode afterChunk, ForkScanner scanner)
Called when hitting the end of a chunk.void
chunkStart(FlowNode startNode, FlowNode beforeBlock, ForkScanner scanner)
Called when hitting the start of a chunk.protected void
handleChunkDone(MemoryFlowChunk chunk)
Override me to do something once the chunk is finished (such as add it to a list).void
parallelBranchEnd(FlowNode parallelStartNode, FlowNode branchEndNode, ForkScanner scanner)
Hit the end start of a parallel branchvoid
parallelBranchStart(FlowNode parallelStartNode, FlowNode branchStartNode, ForkScanner scanner)
Hit the start of a parallel branchvoid
parallelEnd(FlowNode parallelStartNode, FlowNode parallelEndNode, ForkScanner scanner)
Notifies that we've seen the end of a parallel blockvoid
parallelStart(FlowNode parallelStartNode, FlowNode branchNode, ForkScanner scanner)
Notifies that we've hit the start of a parallel block (the point where it branches out).protected void
resetChunk(MemoryFlowChunk chunk)
-
-
-
Field Detail
-
chunk
protected MemoryFlowChunk chunk
-
-
Method Detail
-
handleChunkDone
protected void handleChunkDone(@NonNull MemoryFlowChunk chunk)
Override me to do something once the chunk is finished (such as add it to a list). Note: the chunk will be mutated directly, so you need to copy it if you want to do something.
-
resetChunk
protected void resetChunk(@NonNull MemoryFlowChunk chunk)
-
chunkStart
public void chunkStart(@NonNull FlowNode startNode, @CheckForNull FlowNode beforeBlock, @NonNull ForkScanner scanner)
Description copied from interface:SimpleChunkVisitor
Called when hitting the start of a chunk.- Specified by:
chunkStart
in interfaceSimpleChunkVisitor
- Parameters:
startNode
- First node in chunk (marker), included in nodebeforeBlock
- First node before chunk (null if none exist)scanner
- Forkscanner used (for state tracking)
-
chunkEnd
public void chunkEnd(@NonNull FlowNode endNode, @CheckForNull FlowNode afterChunk, @NonNull ForkScanner scanner)
Description copied from interface:SimpleChunkVisitor
Called when hitting the end of a chunk.- Specified by:
chunkEnd
in interfaceSimpleChunkVisitor
- Parameters:
endNode
- Last node in chunkafterChunk
- Node after chunk (null if we are on the last node)scanner
- Forkscanner used (for state tracking)
-
parallelStart
public void parallelStart(@NonNull FlowNode parallelStartNode, @NonNull FlowNode branchNode, @NonNull ForkScanner scanner)
Description copied from interface:SimpleChunkVisitor
Notifies that we've hit the start of a parallel block (the point where it branches out).- Specified by:
parallelStart
in interfaceSimpleChunkVisitor
- Parameters:
parallelStartNode
- TheBlockStartNode
beginning it, next will be branchesbranchNode
-BlockStartNode
for one of the branches (it will be labelled)scanner
- ForkScanner used
-
parallelEnd
public void parallelEnd(@NonNull FlowNode parallelStartNode, @NonNull FlowNode parallelEndNode, @NonNull ForkScanner scanner)
Description copied from interface:SimpleChunkVisitor
Notifies that we've seen the end of a parallel block- Specified by:
parallelEnd
in interfaceSimpleChunkVisitor
- Parameters:
parallelStartNode
- First node of parallel (BlockStartNode
before the branches)parallelEndNode
- Last node of parallel (BlockEndNode
)scanner
- ForkScanner used
-
parallelBranchStart
public void parallelBranchStart(@NonNull FlowNode parallelStartNode, @NonNull FlowNode branchStartNode, @NonNull ForkScanner scanner)
Description copied from interface:SimpleChunkVisitor
Hit the start of a parallel branch- Specified by:
parallelBranchStart
in interfaceSimpleChunkVisitor
- Parameters:
parallelStartNode
- First node of parallel (BlockStartNode before the branches)branchStartNode
- BlockStartNode beginning the branch (this will have the ThreadNameAction giving its name)scanner
- ForkScanner used
-
parallelBranchEnd
public void parallelBranchEnd(@NonNull FlowNode parallelStartNode, @NonNull FlowNode branchEndNode, @NonNull ForkScanner scanner)
Description copied from interface:SimpleChunkVisitor
Hit the end start of a parallel branchMay not be invoked if we're inside an in-progress parallel
- Specified by:
parallelBranchEnd
in interfaceSimpleChunkVisitor
- Parameters:
parallelStartNode
- First node of parallel (BlockStartNode before the branches)branchEndNode
- Final node of the branch (may be BlockEndNode if done, otherwise just the last one executed)scanner
- ForkScanner used
-
atomNode
public void atomNode(@CheckForNull FlowNode before, @NonNull FlowNode atomNode, @CheckForNull FlowNode after, @NonNull ForkScanner scan)
Extend me to do something with nodes inside a chunk- Specified by:
atomNode
in interfaceSimpleChunkVisitor
- Parameters:
before
- Node before the currentatomNode
- The node itselfafter
- Node after the currentscan
- Reference to our forkscanner, if we want to poke at the state within
-
-