Package org.dataloader.instrumentation
Class DataLoaderInstrumentationHelper
java.lang.Object
org.dataloader.instrumentation.DataLoaderInstrumentationHelper
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DataLoaderInstrumentation
A well known noopDataLoaderInstrumentation
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> DataLoaderInstrumentationContext<T>
Check theDataLoaderInstrumentationContext
to see if its null and returns a noop if it is or else the original context.static <T> DataLoaderInstrumentationContext<T>
noOpCtx()
Returns a noopDataLoaderInstrumentationContext
of the right typestatic <U> DataLoaderInstrumentationContext<U>
whenCompleted
(BiConsumer<U, Throwable> codeToRun) Allows for the more fluent away to return an instrumentation context that runs the specified code on instrumentation step completion.static <U> DataLoaderInstrumentationContext<U>
whenDispatched
(Runnable codeToRun) Allows for the more fluent away to return an instrumentation context that runs the specified code on instrumentation step dispatch.
-
Field Details
-
NOOP_INSTRUMENTATION
A well known noopDataLoaderInstrumentation
-
-
Constructor Details
-
DataLoaderInstrumentationHelper
public DataLoaderInstrumentationHelper()
-
-
Method Details
-
noOpCtx
Returns a noopDataLoaderInstrumentationContext
of the right type- Type Parameters:
T
- for two- Returns:
- a noop context
-
whenDispatched
Allows for the more fluent away to return an instrumentation context that runs the specified code on instrumentation step dispatch.- Type Parameters:
U
- the generic type- Parameters:
codeToRun
- the code to run on dispatch- Returns:
- an instrumentation context
-
whenCompleted
public static <U> DataLoaderInstrumentationContext<U> whenCompleted(BiConsumer<U, Throwable> codeToRun) Allows for the more fluent away to return an instrumentation context that runs the specified code on instrumentation step completion.- Type Parameters:
U
- the generic type- Parameters:
codeToRun
- the code to run on completion- Returns:
- an instrumentation context
-
ctxOrNoopCtx
public static <T> DataLoaderInstrumentationContext<T> ctxOrNoopCtx(DataLoaderInstrumentationContext<T> ic) Check theDataLoaderInstrumentationContext
to see if its null and returns a noop if it is or else the original context. This is a bit of a helper method.- Type Parameters:
T
- for two- Parameters:
ic
- the context in play- Returns:
- a non null context
-