Package org.dataloader.scheduler
Interface BatchLoaderScheduler
-
public interface BatchLoaderSchedulerBy default, whenDataLoader.dispatch()is called, theBatchLoader/MappedBatchLoaderfunction will be invoked immediately. However, you can provide your ownBatchLoaderSchedulerthat allows this call to be done some time into the future. You will be passed a callback (BatchLoaderScheduler.ScheduledBatchLoaderCall/BatchLoaderScheduler.ScheduledMappedBatchLoaderCalland you are expected to eventually call this callback method to make the batch loading happen.Note: Because there is a
DataLoaderOptions.maxBatchSize()it is possible for this scheduling to happen N times for a givenDataLoader.dispatch()call. The total set of keys will be sliced into batches themselves and then theBatchLoaderSchedulerwill be called for each batch of keys. Do not assume that a single call toDataLoader.dispatch()results in a single call toBatchLoaderScheduler.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceBatchLoaderScheduler.ScheduledBatchLoaderCall<V>This represents a callback that will invoke aBatchLoaderfunction under the coversstatic interfaceBatchLoaderScheduler.ScheduledBatchPublisherCallThis represents a callback that will invoke aBatchPublisherorMappedBatchPublisherfunction under the coversstatic interfaceBatchLoaderScheduler.ScheduledMappedBatchLoaderCall<K,V>This represents a callback that will invoke aMappedBatchLoaderfunction under the covers
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <K,V>
java.util.concurrent.CompletionStage<java.util.List<V>>scheduleBatchLoader(BatchLoaderScheduler.ScheduledBatchLoaderCall<V> scheduledCall, java.util.List<K> keys, BatchLoaderEnvironment environment)This is called to schedule aBatchLoadercall.<K> voidscheduleBatchPublisher(BatchLoaderScheduler.ScheduledBatchPublisherCall scheduledCall, java.util.List<K> keys, BatchLoaderEnvironment environment)This is called to schedule aBatchPublishercall.<K,V>
java.util.concurrent.CompletionStage<java.util.Map<K,V>>scheduleMappedBatchLoader(BatchLoaderScheduler.ScheduledMappedBatchLoaderCall<K,V> scheduledCall, java.util.List<K> keys, BatchLoaderEnvironment environment)This is called to schedule aMappedBatchLoadercall.
-
-
-
Method Detail
-
scheduleBatchLoader
<K,V> java.util.concurrent.CompletionStage<java.util.List<V>> scheduleBatchLoader(BatchLoaderScheduler.ScheduledBatchLoaderCall<V> scheduledCall, java.util.List<K> keys, BatchLoaderEnvironment environment)
This is called to schedule aBatchLoadercall.- Type Parameters:
K- the key typeV- the value type- Parameters:
scheduledCall- the callback that needs to be invoked to allow theBatchLoaderto proceed.keys- this is the list of keys that will be passed to theBatchLoader. This is provided only for informative reasons, and you can't change the keys that are usedenvironment- this is theBatchLoaderEnvironmentin place, which can be null if it's a simpleBatchLoadercall- Returns:
- a promise to the values that come from the
BatchLoader
-
scheduleMappedBatchLoader
<K,V> java.util.concurrent.CompletionStage<java.util.Map<K,V>> scheduleMappedBatchLoader(BatchLoaderScheduler.ScheduledMappedBatchLoaderCall<K,V> scheduledCall, java.util.List<K> keys, BatchLoaderEnvironment environment)
This is called to schedule aMappedBatchLoadercall.- Type Parameters:
K- the key typeV- the value type- Parameters:
scheduledCall- the callback that needs to be invoked to allow theMappedBatchLoaderto proceed.keys- this is the list of keys that will be passed to theMappedBatchLoader. This is provided only for informative reasons and, you can't change the keys that are usedenvironment- this is theBatchLoaderEnvironmentin place, which can be null if it's a simpleMappedBatchLoadercall- Returns:
- a promise to the values that come from the
BatchLoader
-
scheduleBatchPublisher
<K> void scheduleBatchPublisher(BatchLoaderScheduler.ScheduledBatchPublisherCall scheduledCall, java.util.List<K> keys, BatchLoaderEnvironment environment)
This is called to schedule aBatchPublishercall.- Type Parameters:
K- the key type- Parameters:
scheduledCall- the callback that needs to be invoked to allow theBatchPublisherto proceed.keys- this is the list of keys that will be passed to theBatchPublisher. This is provided only for informative reasons and, you can't change the keys that are usedenvironment- this is theBatchLoaderEnvironmentin place, which can be null if it's a simpleBatchPublishercall
-
-