public interface InvocationInstrumenter
Modifier and Type | Field and Description |
---|---|
static InvocationInstrumenter |
NOOP
Noop implementation if
InvocationInstrumenter . |
Modifier and Type | Method and Description |
---|---|
static InvocationInstrumenter |
combine(Collection<InvocationInstrumenter> invocationInstrumenters)
Combines multiple instrumenters into one.
|
static <V> Callable<V> |
instrument(Callable<V> callable,
Collection<InvocationInstrumenter> invocationInstrumenters)
Wraps
Callable with instrumentation invocations. |
static <V> Callable<V> |
instrument(Callable<V> callable,
InvocationInstrumenter invocationInstrumenter)
Wraps
Callable with instrumentation invocations. |
static Executor |
instrument(Executor executor,
InvocationInstrumenter invocationInstrumenter)
Wraps the
executor so that every tasks submitted to it will be executed instrumented with the given
invocationInstrumenter . |
static Runnable |
instrument(Runnable runnable,
Collection<InvocationInstrumenter> invocationInstrumenters)
Wraps
Runnable with instrumentation invocations. |
static Runnable |
instrument(Runnable runnable,
InvocationInstrumenter invocationInstrumenter)
Wraps
Runnable with instrumentation invocations. |
Instrumentation |
newInstrumentation() |
static final InvocationInstrumenter NOOP
InvocationInstrumenter
.@NonNull Instrumentation newInstrumentation()
Instrumentation
instance which to be used in a try-with-resources to do the
instrumentation. To force cleanup invoke Instrumentation.forceCleanup()
on the retuned instance.@NonNull static InvocationInstrumenter combine(Collection<InvocationInstrumenter> invocationInstrumenters)
invocationInstrumenters
- instrumenters to combine@NonNull static Runnable instrument(@NonNull Runnable runnable, Collection<InvocationInstrumenter> invocationInstrumenters)
Runnable
with instrumentation invocations.runnable
- Runnable
to be wrappedinvocationInstrumenters
- instrumenters to be used@NonNull static <V> Callable<V> instrument(@NonNull Callable<V> callable, Collection<InvocationInstrumenter> invocationInstrumenters)
Callable
with instrumentation invocations.V
- callable generic paramcallable
- Callable
to be wrappedinvocationInstrumenters
- instrumenters to be used@NonNull static Runnable instrument(@NonNull Runnable runnable, InvocationInstrumenter invocationInstrumenter)
Runnable
with instrumentation invocations.runnable
- Runnable
to be wrappedinvocationInstrumenter
- instrumenter to be used@NonNull static <V> Callable<V> instrument(@NonNull Callable<V> callable, InvocationInstrumenter invocationInstrumenter)
Callable
with instrumentation invocations.V
- callable generic paramcallable
- Callable
to be wrappedinvocationInstrumenter
- instrumenter to be usedstatic Executor instrument(@NonNull Executor executor, @NonNull InvocationInstrumenter invocationInstrumenter)
executor
so that every tasks submitted to it will be executed instrumented with the given
invocationInstrumenter
. Execution itself will be delegated to the underlying executor
, but it has
to be considered that all instrumentation will be done with this very same invocationInstrumenter
instance. This is especially useful when follow-up actions of a given task need to be registered, where a new
instrumenter, thus a new wrapped executor instance belongs to each task.
The returned wrapped executor be of subtype ExecutorService
or ScheduledExecutorService
if the
input executor instance implemented those interfaces.
executor
- the executor to wrapinvocationInstrumenter
- the instrumenter to be used upon task executions with the returned executor