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 newDataLoaderInstrumentationto the list and creates a newChainedDataLoaderInstrumentationaddAll(Collection<DataLoaderInstrumentation> instrumentations) Adds a collection ofDataLoaderInstrumentationto the list and creates a newChainedDataLoaderInstrumentationbeginBatchLoader(DataLoader<?, ?> dataLoader, List<?> keys, BatchLoaderEnvironment environment) This call back is done just before the `batch loader` of aDataLoaderis 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 newDataLoaderInstrumentationto the list and creates a newChainedDataLoaderInstrumentation
-
Constructor Details
-
ChainedDataLoaderInstrumentation
public ChainedDataLoaderInstrumentation() -
ChainedDataLoaderInstrumentation
-
-
Method Details
-
getInstrumentations
-
add
Adds a newDataLoaderInstrumentationto the list and creates a newChainedDataLoaderInstrumentation- Parameters:
instrumentation- the one to add- Returns:
- a new ChainedDataLoaderInstrumentation object
-
prepend
Prepends a newDataLoaderInstrumentationto 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 ofDataLoaderInstrumentationto 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: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<List<?>> beginBatchLoader(DataLoader<?, ?> dataLoader, 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
-