@PublicApi public class SimpleInstrumentationContext<T> extends java.lang.Object implements InstrumentationContext<T>
InstrumentationContext
Constructor and Description |
---|
SimpleInstrumentationContext() |
Modifier and Type | Method and Description |
---|---|
void |
onCompleted(T result,
java.lang.Throwable t)
This is invoked when the instrumentation step is fully completed
|
void |
onDispatched(java.util.concurrent.CompletableFuture<T> result)
This is invoked when the instrumentation step is initially dispatched
|
static <U> SimpleInstrumentationContext<U> |
whenCompleted(java.util.function.BiConsumer<U,java.lang.Throwable> codeToRun)
Allows for the more fluent away to return an instrumentation context that runs the specified
code on instrumentation step completion.
|
static <U> SimpleInstrumentationContext<U> |
whenDispatched(java.util.function.Consumer<java.util.concurrent.CompletableFuture<U>> codeToRun)
Allows for the more fluent away to return an instrumentation context that runs the specified
code on instrumentation step dispatch.
|
public void onDispatched(java.util.concurrent.CompletableFuture<T> result)
InstrumentationContext
onDispatched
in interface InstrumentationContext<T>
result
- the result of the step as a completable futurepublic void onCompleted(T result, java.lang.Throwable t)
InstrumentationContext
onCompleted
in interface InstrumentationContext<T>
result
- the result of the step (which may be null)t
- this exception will be non null if an exception was thrown during the steppublic static <U> SimpleInstrumentationContext<U> whenDispatched(java.util.function.Consumer<java.util.concurrent.CompletableFuture<U>> codeToRun)
U
- the generic typecodeToRun
- the code to run on dispatchpublic static <U> SimpleInstrumentationContext<U> whenCompleted(java.util.function.BiConsumer<U,java.lang.Throwable> codeToRun)
U
- the generic typecodeToRun
- the code to run on completion