Package org.dataloader.instrumentation
Class ChainedDataLoaderInstrumentation
java.lang.Object
org.dataloader.instrumentation.ChainedDataLoaderInstrumentation
- All Implemented Interfaces:
DataLoaderInstrumentation
@PublicApi
public class ChainedDataLoaderInstrumentation
extends Object
implements DataLoaderInstrumentation
This
DataLoaderInstrumentation
can chain together multiple instrumentations and have them all called in
the order of the provided list.-
Constructor Summary
ConstructorsConstructorDescriptionChainedDataLoaderInstrumentation
(List<DataLoaderInstrumentation> instrumentations) -
Method Summary
Modifier and TypeMethodDescriptionadd
(DataLoaderInstrumentation instrumentation) Adds a newDataLoaderInstrumentation
to the list and creates a newChainedDataLoaderInstrumentation
addAll
(Collection<DataLoaderInstrumentation> instrumentations) Adds a collection ofDataLoaderInstrumentation
to the list and creates a newChainedDataLoaderInstrumentation
beginBatchLoader
(DataLoader<?, ?> dataLoader, List<?> keys, BatchLoaderEnvironment environment) This call back is done just before the `batch loader` of aDataLoader
is invoked.beginDispatch
(DataLoader<?, ?> dataLoader) This call back is done just before theDataLoader.dispatch()
is invoked, and it completes when the dispatch call promise is done.beginLoad
(DataLoader<?, ?> dataLoader, Object key, Object loadContext) This call back is done just before theDataLoader.load(Object)
methods are invoked, and it completes when the load promise is completed.prepend
(DataLoaderInstrumentation instrumentation) Prepends a newDataLoaderInstrumentation
to the list and creates a newChainedDataLoaderInstrumentation
-
Constructor Details
-
ChainedDataLoaderInstrumentation
public ChainedDataLoaderInstrumentation() -
ChainedDataLoaderInstrumentation
-
-
Method Details
-
getInstrumentations
-
add
Adds a newDataLoaderInstrumentation
to the list and creates a newChainedDataLoaderInstrumentation
- Parameters:
instrumentation
- the one to add- Returns:
- a new ChainedDataLoaderInstrumentation object
-
prepend
Prepends a newDataLoaderInstrumentation
to the list and creates a newChainedDataLoaderInstrumentation
- Parameters:
instrumentation
- the one to add- Returns:
- a new ChainedDataLoaderInstrumentation object
-
addAll
public ChainedDataLoaderInstrumentation addAll(Collection<DataLoaderInstrumentation> instrumentations) Adds a collection ofDataLoaderInstrumentation
to the list and creates a newChainedDataLoaderInstrumentation
- Parameters:
instrumentations
- the new ones to add- Returns:
- a new ChainedDataLoaderInstrumentation object
-
beginLoad
public DataLoaderInstrumentationContext<Object> beginLoad(DataLoader<?, ?> dataLoader, Object key, Object loadContext) Description copied from interface:DataLoaderInstrumentation
This call back is done just before theDataLoader.load(Object)
methods are invoked, and it completes when the load promise is completed. If the value is a cachedCompletableFuture
then it might return almost immediately, otherwise it will return when the batch load function is invoked and values get returned- Specified by:
beginLoad
in interfaceDataLoaderInstrumentation
- Parameters:
dataLoader
- theDataLoader
in questionkey
- the key used during theDataLoader.load(Object)
callloadContext
- the load context used during theDataLoader.load(Object, Object)
call- Returns:
- a DataLoaderInstrumentationContext or null to be more performant
-
beginDispatch
public DataLoaderInstrumentationContext<DispatchResult<?>> beginDispatch(DataLoader<?, ?> dataLoader) Description copied from interface:DataLoaderInstrumentation
This call back is done just before theDataLoader.dispatch()
is invoked, and it completes when the dispatch call promise is done.- Specified by:
beginDispatch
in interfaceDataLoaderInstrumentation
- Parameters:
dataLoader
- theDataLoader
in question- Returns:
- a DataLoaderInstrumentationContext or null to be more performant
-
beginBatchLoader
public DataLoaderInstrumentationContext<List<?>> beginBatchLoader(DataLoader<?, ?> dataLoader, List<?> keys, BatchLoaderEnvironment environment) Description copied from interface:DataLoaderInstrumentation
This call back is done just before the `batch loader` of aDataLoader
is invoked. Remember a batch loader could be called multiple times during a dispatch event (because of max batch sizes)- Specified by:
beginBatchLoader
in interfaceDataLoaderInstrumentation
- Parameters:
dataLoader
- theDataLoader
in questionkeys
- the set of keys being fetchedenvironment
- theBatchLoaderEnvironment
- Returns:
- a DataLoaderInstrumentationContext or null to be more performant
-