Interface Batch

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
TransactionBatch
All Known Implementing Classes:
ThreadLocalTransactionBatch

public interface Batch extends 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 Details

    • suspend

      SuspendedBatch suspend()
      Suspends this batch.
      Returns:
      a suspended batch
    • suspendWithContext

      default BatchContext<SuspendedBatch> suspendWithContext()
      Suspends this batch until Context.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:
      close in interface AutoCloseable
    • factory

      static Supplier<Batch> factory()
      Returns a factory for creating no-op batches.
      Returns:
      a batch factory