Package com.tonic.analysis.query.exec
Class QueryBatchRunner
- java.lang.Object
-
- com.tonic.analysis.query.exec.QueryBatchRunner
-
public class QueryBatchRunner extends Object
Executor of aProbePlanover a class pool, evaluating the query condition on every candidate the plan's scope filter admits and projecting each hit into aQueryMatchcarrying the evaluator's evidence.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceQueryBatchRunner.ProgressListenerCallback for run progress, invoked on the thread executing the run.static classQueryBatchRunner.QueryBatchResultThe outcome of one run - the ordered matches plus whether the run was cut short by cancellation.
-
Constructor Summary
Constructors Constructor Description QueryBatchRunner(ClassPool classPool)Creates a runner over a pool, defaulting to a 60 second budget and no user-class restriction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Requests that an in-flight run stop at the next candidate; the flag is cleared when a run starts.QueryBatchRunner.QueryBatchResultrun(ProbePlan plan, QueryBatchRunner.ProgressListener listener)Evaluates the plan's condition over every class or method the scope filter admits, then applies the query's ordering and limit.voidsetTimeBudgetMs(long ms)Sets the wall-clock budget after which a run stops early and reports what it has.voidsetUserClassNames(Set<String> userClassNames)Restricts the search to named classes; a null or empty set searches the whole pool.
-
-
-
Constructor Detail
-
QueryBatchRunner
public QueryBatchRunner(ClassPool classPool)
Creates a runner over a pool, defaulting to a 60 second budget and no user-class restriction.- Parameters:
classPool- the classes to search
-
-
Method Detail
-
setUserClassNames
public void setUserClassNames(Set<String> userClassNames)
Restricts the search to named classes; a null or empty set searches the whole pool.- Parameters:
userClassNames- the class names to keep
-
setTimeBudgetMs
public void setTimeBudgetMs(long ms)
Sets the wall-clock budget after which a run stops early and reports what it has.- Parameters:
ms- the budget in milliseconds
-
cancel
public void cancel()
Requests that an in-flight run stop at the next candidate; the flag is cleared when a run starts.
-
run
public QueryBatchRunner.QueryBatchResult run(ProbePlan plan, QueryBatchRunner.ProgressListener listener)
Evaluates the plan's condition over every class or method the scope filter admits, then applies the query's ordering and limit.- Parameters:
plan- the planned querylistener- notified of phase start, progress every 200 methods, and completion, or null- Returns:
- the matches and whether the run was cancelled
-
-