@PublicApi public class SimpleInstrumentationContext<T> extends java.lang.Object implements InstrumentationContext<T>
InstrumentationContext| Constructor and Description |
|---|
SimpleInstrumentationContext() |
| Modifier and Type | Method and Description |
|---|---|
static <T> InstrumentationContext<T> |
noOp()
A context that does nothing
|
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 static <T> InstrumentationContext<T> noOp()
T - the type neededpublic void onDispatched(java.util.concurrent.CompletableFuture<T> result)
InstrumentationContextonDispatched in interface InstrumentationContext<T>result - the result of the step as a completable futurepublic void onCompleted(T result, java.lang.Throwable t)
InstrumentationContextonCompleted 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