ForkJoinParallelCpgPassWithAccumulator
A parallel CPG pass with an accumulator for aggregating side results.
This is the most general form of the fork/join pass framework. It extends ForkJoinParallelCpgPass with an accumulator of type Accumulator that each parallel worker maintains locally. After all parts are processed, worker accumulators are merged via mergeAccumulator, and the final merged accumulator is passed to onAccumulatorComplete where additional graph changes can be recorded.
Type parameters
- Accumulator
-
the type of the accumulator used during parallel execution
- T
-
the type of each part produced by generateParts
Value parameters
- cpg
-
the code property graph to modify
- outName
-
optional output name
Attributes
- Graph
-
- Supertypes
- Known subtypes
Members list
Type members
Types
Value members
Abstract methods
Create a fresh accumulator instance. Called once per parallel worker thread.
Create a fresh accumulator instance. Called once per parallel worker thread.
Attributes
Merge the accumulator (right) into left. Called during the combine phase of fork/join.
Merge the accumulator (right) into left. Called during the combine phase of fork/join.
Attributes
Called once after all parts are processed and accumulators are merged. Use to record additional graph changes based on the fully merged accumulator.
Called once after all parts are processed and accumulators are merged. Use to record additional graph changes based on the fully merged accumulator.
Value parameters
- accumulator
-
the final merged accumulator
- builder
-
the DiffGraphBuilder for any additional modifications
Attributes
Process a single part, recording graph changes in builder and side results in accumulator.
Process a single part, recording graph changes in builder and side results in accumulator.
Value parameters
- accumulator
-
the thread-local accumulator for this worker
- builder
-
the DiffGraphBuilder that accumulates graph modifications
- part
-
the part to process
Attributes
Concrete methods
Creates a new DiffGraphBuilder, runs the pass (init, generateParts, runOnPart, finish), applies all accumulated changes to the graph, and logs timing information. Exceptions during execution are logged and re-thrown.
Creates a new DiffGraphBuilder, runs the pass (init, generateParts, runOnPart, finish), applies all accumulated changes to the graph, and logs timing information. Exceptions during execution are logged and re-thrown.
Attributes
- Definition Classes
Called once before generateParts. Use to set up large data structures or acquire external resources.
Called once before generateParts. Use to set up large data structures or acquire external resources.
Attributes
Override and return false to disable parallel execution. Useful for debugging.
Override and return false to disable parallel execution. Useful for debugging.
Attributes
Runs the full pass lifecycle (init, generateParts, parallel runOnPart, accumulator merge, finish) and absorbs all changes into externalBuilder without applying them to the graph. The caller is responsible for applying the builder.
Runs the full pass lifecycle (init, generateParts, parallel runOnPart, accumulator merge, finish) and absorbs all changes into externalBuilder without applying them to the graph. The caller is responsible for applying the builder.
Value parameters
- externalBuilder
-
the builder to absorb all generated changes into
Attributes
- Returns
-
the number of parts that were processed
- Definition Classes
Deprecated methods
Attributes
- Deprecated
- Please use createAndApply
- Definition Classes
Inherited methods
Attributes
- Inherited from:
- CpgPassBase
Attributes
- Inherited from:
- CpgPassBase
Name of the pass. By default it is inferred from the name of the class, override if needed.
Name of the pass. By default it is inferred from the name of the class, override if needed.
Attributes
- Inherited from:
- CpgPassBase
Wraps runWithBuilder with logging and exception handling. Use with caution — API is unstable.
Wraps runWithBuilder with logging and exception handling. Use with caution — API is unstable.
Value parameters
- builder
-
the DiffGraphBuilder to absorb changes into
Attributes
- Returns
-
the number of parts processed, or
-1if the pass threw an exception - Inherited from:
- CpgPassBase
Executes fun while logging the pass start and completion time (including duration via MDC).
Executes fun while logging the pass start and completion time (including duration via MDC).
Type parameters
- A
-
the return type of the wrapped computation
Value parameters
- fun
-
the computation to execute
Attributes
- Returns
-
the result of
fun - Inherited from:
- CpgPassBase
Deprecated and Inherited methods
Attributes
- Deprecated
- true
- Inherited from:
- CpgPassBase