@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> java.util.function.BiConsumer<? super T,? super java.lang.Throwable> |
completeInstrumentationCtxCF(InstrumentationContext<T> instrumentationContext,
java.util.concurrent.CompletableFuture<T> targetCF) |
static <T> @NotNull InstrumentationContext<T> |
nonNullCtx(InstrumentationContext<T> nullableContext)
This creates a no-op
InstrumentationContext if the one pass in is null |
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 needed@NotNull public static <T> @NotNull InstrumentationContext<T> nonNullCtx(InstrumentationContext<T> nullableContext)
InstrumentationContext if the one pass in is nullT - for twonullableContext - a InstrumentationContext that can be nullInstrumentationContext that maybe a no-oppublic 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 completionpublic static <T> java.util.function.BiConsumer<? super T,? super java.lang.Throwable> completeInstrumentationCtxCF(InstrumentationContext<T> instrumentationContext, java.util.concurrent.CompletableFuture<T> targetCF)