Interface BatchOperation
- All Known Implementing Classes:
AbstractBatchOperation
public interface BatchOperation
A BatchOperation collects together a set of operations that should be executed together as a batch.
The implementation of this class should carefully track changes, and take care to not allow
mutations during execution. However, it's usually smart to not lock during the entire execution, so one common
pattern is to clone the data at the start of exec in a lock, and then operate on that, allowing new data to be
accumulated along the way.
This batch operation will be reused, so the implementation should carefully manage internal data.
- Since:
- 8.0
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute
(ProviderContext context) default long
executeAndReturnSize
(ProviderContext context) Executes the current batch and returns amount of items processed.default int
Returns roughly how long this operation should buffer before executing.void
setController
(BatchOperation.BatchContextController controller) boolean
Indicates that this operation has outstanding data and should be scheduled for execution.
-
Method Details
-
getExecDelayMS
default int getExecDelayMS()Returns roughly how long this operation should buffer before executing. -
setController
-
getController
BatchOperation.BatchContextController getController() -
execute
-
executeAndReturnSize
Executes the current batch and returns amount of items processed.- Returns:
- Amount of items processed in execution, or -1 if not implemented.
-
shouldSchedule
boolean shouldSchedule()Indicates that this operation has outstanding data and should be scheduled for execution.
-