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
ThisDataLoaderInstrumentationcan 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 ChainedDataLoaderInstrumentationadd(DataLoaderInstrumentation instrumentation)Adds a newDataLoaderInstrumentationto the list and creates a newChainedDataLoaderInstrumentationChainedDataLoaderInstrumentationaddAll(java.util.Collection<DataLoaderInstrumentation> instrumentations)Adds a collection ofDataLoaderInstrumentationto the list and creates a newChainedDataLoaderInstrumentationDataLoaderInstrumentationContext<java.util.List<?>>beginBatchLoader(DataLoader<?,?> dataLoader, java.util.List<?> keys, BatchLoaderEnvironment environment)This call back is done just before the `batch loader` of aDataLoaderis 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()ChainedDataLoaderInstrumentationprepend(DataLoaderInstrumentation instrumentation)Prepends a newDataLoaderInstrumentationto 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 newDataLoaderInstrumentationto 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 newDataLoaderInstrumentationto 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 ofDataLoaderInstrumentationto 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:DataLoaderInstrumentationThis 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 cachedCompletableFuturethen it might return almost immediately, otherwise it will return when the batch load function is invoked and values get returned- Specified by:
beginLoadin interfaceDataLoaderInstrumentation- Parameters:
dataLoader- theDataLoaderin 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:DataLoaderInstrumentationThis call back is done just before theDataLoader.dispatch()is invoked, and it completes when the dispatch call promise is done.- Specified by:
beginDispatchin interfaceDataLoaderInstrumentation- Parameters:
dataLoader- theDataLoaderin 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:DataLoaderInstrumentationThis call back is done just before the `batch loader` of aDataLoaderis invoked. Remember a batch loader could be called multiple times during a dispatch event (because of max batch sizes)- Specified by:
beginBatchLoaderin interfaceDataLoaderInstrumentation- Parameters:
dataLoader- theDataLoaderin questionkeys- the set of keys being fetchedenvironment- theBatchLoaderEnvironment- Returns:
- a DataLoaderInstrumentationContext or null to be more performant
-
-