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(java.util.Collection<InvocationInstrumenter> invocationInstrumenters)
Combines multiple instrumenters into one.
|
static <V> java.util.concurrent.Callable<V> |
instrument(java.util.concurrent.Callable<V> callable,
java.util.Collection<InvocationInstrumenter> invocationInstrumenters)
Wraps
Callable with instrumentation invocations. |
static <V> java.util.concurrent.Callable<V> |
instrument(java.util.concurrent.Callable<V> callable,
InvocationInstrumenter invocationInstrumenter)
Wraps
Callable with instrumentation invocations. |
static java.util.concurrent.Executor |
instrument(java.util.concurrent.Executor executor,
InvocationInstrumenter invocationInstrumenter)
Wraps the
executor so that every tasks submitted to it will be executed instrumented with the given
invocationInstrumenter . |
static java.lang.Runnable |
instrument(java.lang.Runnable runnable,
java.util.Collection<InvocationInstrumenter> invocationInstrumenters)
Wraps
Runnable with instrumentation invocations. |
static java.lang.Runnable |
instrument(java.lang.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(java.util.Collection<InvocationInstrumenter> invocationInstrumenters)
invocationInstrumenters
- instrumenters to combine@NonNull static java.lang.Runnable instrument(@NonNull java.lang.Runnable runnable, java.util.Collection<InvocationInstrumenter> invocationInstrumenters)
Runnable
with instrumentation invocations.runnable
- Runnable
to be wrappedinvocationInstrumenters
- instrumenters to be used@NonNull static <V> java.util.concurrent.Callable<V> instrument(@NonNull java.util.concurrent.Callable<V> callable, java.util.Collection<InvocationInstrumenter> invocationInstrumenters)
Callable
with instrumentation invocations.V
- callable generic paramcallable
- Callable
to be wrappedinvocationInstrumenters
- instrumenters to be used@NonNull static java.lang.Runnable instrument(@NonNull java.lang.Runnable runnable, InvocationInstrumenter invocationInstrumenter)
Runnable
with instrumentation invocations.runnable
- Runnable
to be wrappedinvocationInstrumenter
- instrumenter to be used@NonNull static <V> java.util.concurrent.Callable<V> instrument(@NonNull java.util.concurrent.Callable<V> callable, InvocationInstrumenter invocationInstrumenter)
Callable
with instrumentation invocations.V
- callable generic paramcallable
- Callable
to be wrappedinvocationInstrumenter
- instrumenter to be usedstatic java.util.concurrent.Executor instrument(@NonNull java.util.concurrent.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