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
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Batch
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    Discards this batch.
    boolean
    Indicates whether or not this batch is active.
    boolean
    Indicates whether or not this batch was closed.
    boolean
    Indicates whether or not this batch will be discarded.
    Suspends this batch.
    Suspends this batch until Context.close().
  • Field Details

    • CLOSED

      static final Batch CLOSED
  • 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