public class DefaultBatchingConfiguration extends java.lang.Object implements WriteBehindConfiguration.BatchingConfiguration
Enables configuring write-behind batching, first by specifying the batch size. Then a write delay must be configured. It will indicate how long an incomplete batch will wait for extra operations. Finally coalescing can be configure which will make the batch forget all but the last operation on a per key basis.
Constructor and Description |
---|
DefaultBatchingConfiguration(long maxDelay,
java.util.concurrent.TimeUnit maxDelayUnit,
int batchSize,
boolean coalescing)
Creates a new configuration with the provided parameters.
|
Modifier and Type | Method and Description |
---|---|
int |
getBatchSize()
The recommended size of a batch of operations.
|
long |
getMaxDelay()
The maximum time to wait before writing behind.
|
java.util.concurrent.TimeUnit |
getMaxDelayUnit()
The time unit for the maximum delay.
|
boolean |
isCoalescing()
Whether write operations can be coalesced.
|
public DefaultBatchingConfiguration(long maxDelay, java.util.concurrent.TimeUnit maxDelayUnit, int batchSize, boolean coalescing)
maxDelay
- the maximum write delay quantitymaxDelayUnit
- the maximu write delay unitbatchSize
- the batch sizecoalescing
- whether the batch is to be coalescedpublic long getMaxDelay()
getMaxDelay
in interface WriteBehindConfiguration.BatchingConfiguration
public java.util.concurrent.TimeUnit getMaxDelayUnit()
getMaxDelayUnit
in interface WriteBehindConfiguration.BatchingConfiguration
public boolean isCoalescing()
Write coalescing ensure that operations within a batch for the same key will be coalesced in to a single write operation.
isCoalescing
in interface WriteBehindConfiguration.BatchingConfiguration
true
if write coalescing enabledpublic int getBatchSize()
Only positive values are legal. A value of 1 indicates that no batching should happen. Real batch size will be influenced by the write rate and the max write delay.
getBatchSize
in interface WriteBehindConfiguration.BatchingConfiguration