public final class ExecutionListener.Builder extends Object
For further details.| Modifier and Type | Method and Description |
|---|---|
ExecutionListener |
attach(Engine engine)
Creates a new execution listener using the current builder configuration and attaches it
to an engine.
|
ExecutionListener.Builder |
collectExceptions(boolean enabled)
Collect additional execution event data about errors.
|
ExecutionListener.Builder |
collectInputValues(boolean enabled)
Collect additional execution event data for input values.
|
ExecutionListener.Builder |
collectReturnValue(boolean enabled)
Collect additional execution event data about return values.
|
ExecutionListener.Builder |
expressions(boolean enabled)
Include program locations that are marked as expressions.
|
ExecutionListener.Builder |
onEnter(Consumer<ExecutionEvent> listener)
Set a listener that is notified when an execution of an element is entered.
|
ExecutionListener.Builder |
onReturn(Consumer<ExecutionEvent> listener)
Set a listener that is notified when an execution of an element was entered and
completed.
|
ExecutionListener.Builder |
rootNameFilter(Predicate<String> predicate)
Set an addition filter execution events by root name.
|
ExecutionListener.Builder |
roots(boolean enabled)
Include program locations that are marked as root of a function, method or closure.
|
ExecutionListener.Builder |
sourceFilter(Predicate<Source> predicate)
Set an addition filter that filters execution events by source.
|
ExecutionListener.Builder |
statements(boolean enabled)
Include program locations that are marked as statements.
|
public ExecutionListener.Builder onEnter(Consumer<ExecutionEvent> listener)
public ExecutionListener.Builder onReturn(Consumer<ExecutionEvent> listener)
public ExecutionListener.Builder sourceFilter(Predicate<Source> predicate)
predicate - the source predicate that returns true for a source to be
included and false otherwise.public ExecutionListener.Builder rootNameFilter(Predicate<String> predicate)
public ExecutionListener.Builder roots(boolean enabled)
enabled - true if enabled, else falseExecutionListener.Builder.expressions(boolean),
ExecutionListener.Builder.statements(boolean)public ExecutionListener.Builder statements(boolean enabled)
enabled - true if enabled, else falseExecutionListener.Builder.expressions(boolean),
ExecutionListener.Builder.roots(boolean)public ExecutionListener.Builder expressions(boolean enabled)
enabled - true if enabled, else falseExecutionListener.Builder.statements(boolean),
ExecutionListener.Builder.roots(boolean)public ExecutionListener.Builder collectInputValues(boolean enabled)
OnReturn events with
ExecutionEvent.getInputValues().
If additional event data is collected then the peak performance overhead of execution listeners is significant. It is not recommended to collect additional event data when running production workloads.
enabled - true if enabled, else falsepublic ExecutionListener.Builder collectReturnValue(boolean enabled)
OnReturn events with
ExecutionEvent.getReturnValue().
If additional event data is collected then the peak performance overhead of execution listeners is significant. It is not recommended to collect additional event data when running production workloads.
enabled - true if enabled, else falsepublic ExecutionListener.Builder collectExceptions(boolean enabled)
OnReturn events with ExecutionEvent.getException().
If additional event data is collected then the peak performance overhead of execution listeners is significant. It is not recommended to collect additional event data when running production workloads.
enabled - true if enabled, else falsepublic ExecutionListener attach(Engine engine)
Execution listeners cannot be attached to engines that were statically looked up using
Context.. For security reasons only the original
getCurrent().getEngine()
creator of the context or engine is
allowed to perform this action.
Attaching and closing execution listeners
are expensive operations and typically require to traverse through all loaded code. Code
that was previously optimized will be deoptimized in the process. It is most efficient to
attach an execution listener before any code is executed and let execution listeners
automatically close with the engine.
engine - the engine to attach toPolyglotException - if one of the provided filter predicate fails.