Package org.dataloader
Class DataLoaderOptions
java.lang.Object
org.dataloader.DataLoaderOptions
Configuration options for
DataLoader instances. This is an immutable class so each time
you change a value it returns a new object.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new data loader options with default settings. -
Method Summary
Modifier and TypeMethodDescriptionbooleanOption that determines whether to use batching (the default), or not.Gets an (optional) function to invoke for creation of the cache key, if caching is enabled.cacheMap()Gets the (optional) cache map implementation that is used for caching, if caching is enabled.booleanOption that determines whether to use caching of futures (the default), or not.booleanOption that determines whether to cache exceptional values (the default), or not.booleanintGets the maximum number of keys that will be presented to theBatchLoaderfunction before they are split into multiple classstatic DataLoaderOptionsstatic DataLoaderOptions.Builderstatic DataLoaderOptions.BuildernewOptions(DataLoaderOptions otherOptions) Copies the options into a new buildertransform(Consumer<DataLoaderOptions.Builder> builderConsumer) Will transform the current options in to a builder ands allow you to build a new set of optionsOptional<ValueCache<?,?>> Gets the (optional) cache store implementation that is used for value caching, if caching is enabled.
-
Constructor Details
-
DataLoaderOptions
public DataLoaderOptions()Creates a new data loader options with default settings.
-
-
Method Details
-
newDefaultOptions
- Returns:
- a new default data loader options that you can then customize
-
newOptions
- Returns:
- a new default data loader options builder that you can then customize
-
newOptions
Copies the options into a new builder- Returns:
- a new default data loader options builder that you can then customize
-
transform
Will transform the current options in to a builder ands allow you to build a new set of options- Parameters:
builderConsumer- the consumer of a builder that has this objects starting values- Returns:
- a new
DataLoaderOptionsobject
-
equals
-
batchingEnabled
public boolean batchingEnabled()Option that determines whether to use batching (the default), or not.- Returns:
truewhen batching is enabled,falseotherwise
-
cachingEnabled
public boolean cachingEnabled()Option that determines whether to use caching of futures (the default), or not.- Returns:
truewhen caching is enabled,falseotherwise
-
cachingExceptionsEnabled
public boolean cachingExceptionsEnabled()Option that determines whether to cache exceptional values (the default), or not.For short-lived caches (that is request caches) it makes sense to cache exceptions since it's likely the key is still poisoned. However, if you have long-lived caches, then it may make sense to set this to false since the downstream system may have recovered from its failure mode.
- Returns:
truewhen exceptional values are cached is enabled,falseotherwise
-
cacheKeyFunction
Gets an (optional) function to invoke for creation of the cache key, if caching is enabled.If missing the cache key defaults to the
keytype parameter of the data loader of typeK.- Returns:
- an optional with the function, or empty optional
-
cacheMap
Gets the (optional) cache map implementation that is used for caching, if caching is enabled.If missing a standard
LinkedHashMapwill be used as the cache implementation.- Returns:
- an optional with the cache map instance, or empty
-
maxBatchSize
public int maxBatchSize()Gets the maximum number of keys that will be presented to theBatchLoaderfunction before they are split into multiple class- Returns:
- the maximum batch size or -1 if there is no limit
-
getStatisticsCollector
- Returns:
- the statistics collector to use with these options
-
getBatchLoaderContextProvider
- Returns:
- the batch environment provider that will be used to give context to batch load functions
-
valueCache
Gets the (optional) cache store implementation that is used for value caching, if caching is enabled.If missing, a no-op implementation will be used.
- Returns:
- an optional with the cache store instance, or empty
-
getValueCacheOptions
- Returns:
- the
ValueCacheOptionsthat control how theValueCachewill be used
-
getBatchLoaderScheduler
- Returns:
- the
BatchLoaderSchedulerto use, which can be null
-
getInstrumentation
- Returns:
- the
DataLoaderInstrumentationto use
-