Class StandardChunkVisitor
java.lang.Object
org.jenkinsci.plugins.workflow.graphanalysis.StandardChunkVisitor
- All Implemented Interfaces:
SimpleChunkVisitor
Simple handler for linear
FlowChunks (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.
Extend handleChunkDone(MemoryFlowChunk) to gather up final chunks.
Extend atomNode(FlowNode, FlowNode, FlowNode, ForkScanner) to gather data about nodes in a chunk.- Author:
- Sam Van Oort
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidatomNode(FlowNode before, FlowNode atomNode, FlowNode after, ForkScanner scan) Extend me to do something with nodes inside a chunkvoidchunkEnd(FlowNode endNode, FlowNode afterChunk, ForkScanner scanner) Called when hitting the end of a chunk.voidchunkStart(FlowNode startNode, FlowNode beforeBlock, ForkScanner scanner) Called when hitting the start of a chunk.protected voidhandleChunkDone(MemoryFlowChunk chunk) Override me to do something once the chunk is finished (such as add it to a list).voidparallelBranchEnd(FlowNode parallelStartNode, FlowNode branchEndNode, ForkScanner scanner) Hit the end start of a parallel branchvoidparallelBranchStart(FlowNode parallelStartNode, FlowNode branchStartNode, ForkScanner scanner) Hit the start of a parallel branchvoidparallelEnd(FlowNode parallelStartNode, FlowNode parallelEndNode, ForkScanner scanner) Notifies that we've seen the end of a parallel blockvoidparallelStart(FlowNode parallelStartNode, FlowNode branchNode, ForkScanner scanner) Notifies that we've hit the start of a parallel block (the point where it branches out).protected voidresetChunk(MemoryFlowChunk chunk)
-
Field Details
-
chunk
-
-
Constructor Details
-
StandardChunkVisitor
public StandardChunkVisitor()
-
-
Method Details
-
handleChunkDone
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
-
chunkStart
public void chunkStart(@NonNull FlowNode startNode, @CheckForNull FlowNode beforeBlock, @NonNull ForkScanner scanner) Description copied from interface:SimpleChunkVisitorCalled when hitting the start of a chunk.- Specified by:
chunkStartin 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:SimpleChunkVisitorCalled when hitting the end of a chunk.- Specified by:
chunkEndin 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:SimpleChunkVisitorNotifies that we've hit the start of a parallel block (the point where it branches out).- Specified by:
parallelStartin interfaceSimpleChunkVisitor- Parameters:
parallelStartNode- TheBlockStartNodebeginning it, next will be branchesbranchNode-BlockStartNodefor 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:SimpleChunkVisitorNotifies that we've seen the end of a parallel block- Specified by:
parallelEndin interfaceSimpleChunkVisitor- Parameters:
parallelStartNode- First node of parallel (BlockStartNodebefore 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:SimpleChunkVisitorHit the start of a parallel branch- Specified by:
parallelBranchStartin 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:SimpleChunkVisitorHit the end start of a parallel branchMay not be invoked if we're inside an in-progress parallel
- Specified by:
parallelBranchEndin 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:
atomNodein 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
-