Interface Batch
- All Superinterfaces:
AutoCloseable
Instruments the batching of cache operations.
Write-only cache operations invoked while this batch is active (i.e. not suspended) will defer invocation until
close().
Calling discard() will cause close() to undo previous write operations and discard any accumulated write-only operations (similar to setRollbackOnly() semantics).- Author:
- Paul Ferraro
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voiddiscard()Discards this batch.factory()Returns a factory for creating no-op batches.booleanisActive()Indicates whether or not this batch is active.booleanisClosed()Indicates whether or not this batch was closed.booleanIndicates whether or not this batch will be discarded.suspend()Suspends this batch.default BatchContext<SuspendedBatch>Suspends this batch untilContext.close().
-
Method Details
-
suspend
SuspendedBatch suspend()Suspends this batch.- Returns:
- a suspended batch
-
suspendWithContext
Suspends this batch untilContext.close().- Returns:
- a suspended batch context
-
discard
void discard()Discards this batch. A discarded batch must still be closed. -
isActive
boolean isActive()Indicates whether or not this batch is active.- Returns:
- true, if this batch is active, false otherwise.
-
isDiscarding
boolean isDiscarding()Indicates whether or not this batch will be discarded.- Returns:
- true, if this batch was discarded, false otherwise.
-
isClosed
boolean isClosed()Indicates whether or not this batch was closed.- Returns:
- true, if this batch was closed, false otherwise.
-
close
void close()- Specified by:
closein interfaceAutoCloseable
-
factory
Returns a factory for creating no-op batches.- Returns:
- a batch factory
-