Package org.dataloader.instrumentation
Class ChainedDataLoaderInstrumentation
- java.lang.Object
-
- org.dataloader.instrumentation.ChainedDataLoaderInstrumentation
-
- All Implemented Interfaces:
DataLoaderInstrumentation
@PublicApi public class ChainedDataLoaderInstrumentation extends java.lang.Object implements DataLoaderInstrumentation
ThisDataLoaderInstrumentation
can chain together multiple instrumentations and have them all called in the order of the provided list.
-
-
Constructor Summary
Constructors Constructor Description ChainedDataLoaderInstrumentation()
ChainedDataLoaderInstrumentation(java.util.List<DataLoaderInstrumentation> instrumentations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChainedDataLoaderInstrumentation
add(DataLoaderInstrumentation instrumentation)
Adds a newDataLoaderInstrumentation
to the list and creates a newChainedDataLoaderInstrumentation
ChainedDataLoaderInstrumentation
addAll(java.util.Collection<DataLoaderInstrumentation> instrumentations)
Adds a collection ofDataLoaderInstrumentation
to the list and creates a newChainedDataLoaderInstrumentation
DataLoaderInstrumentationContext<java.util.List<?>>
beginBatchLoader(DataLoader<?,?> dataLoader, java.util.List<?> keys, BatchLoaderEnvironment environment)
This call back is done just before the `batch loader` of aDataLoader
is invoked.DataLoaderInstrumentationContext<DispatchResult<?>>
beginDispatch(DataLoader<?,?> dataLoader)
This call back is done just before theDataLoader.dispatch()
is invoked, and it completes when the dispatch call promise is done.DataLoaderInstrumentationContext<java.lang.Object>
beginLoad(DataLoader<?,?> dataLoader, java.lang.Object key, java.lang.Object loadContext)
This call back is done just before theDataLoader.load(Object)
methods are invoked, and it completes when the load promise is completed.java.util.List<DataLoaderInstrumentation>
getInstrumentations()
ChainedDataLoaderInstrumentation
prepend(DataLoaderInstrumentation instrumentation)
Prepends a newDataLoaderInstrumentation
to the list and creates a newChainedDataLoaderInstrumentation
-
-
-
Constructor Detail
-
ChainedDataLoaderInstrumentation
public ChainedDataLoaderInstrumentation()
-
ChainedDataLoaderInstrumentation
public ChainedDataLoaderInstrumentation(java.util.List<DataLoaderInstrumentation> instrumentations)
-
-
Method Detail
-
getInstrumentations
public java.util.List<DataLoaderInstrumentation> getInstrumentations()
-
add
public ChainedDataLoaderInstrumentation add(DataLoaderInstrumentation instrumentation)
Adds a newDataLoaderInstrumentation
to the list and creates a newChainedDataLoaderInstrumentation
- Parameters:
instrumentation
- the one to add- Returns:
- a new ChainedDataLoaderInstrumentation object
-
prepend
public ChainedDataLoaderInstrumentation prepend(DataLoaderInstrumentation instrumentation)
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(java.util.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<java.lang.Object> beginLoad(DataLoader<?,?> dataLoader, java.lang.Object key, java.lang.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<java.util.List<?>> beginBatchLoader(DataLoader<?,?> dataLoader, java.util.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
-
-