Interface StreamingTransactionCapable

All Known Implementing Classes:
StreamingTransactionCapableUtil

public interface StreamingTransactionCapable
Utility used for running transactional operations. Streaming operations are interesting because you may want to iterate over a large set of data and perform some work in a transaction. In order to limit transaction times and conserve heap, iterating over the large set should be done in chunks and the level 1 cache should be clear between each chunk. This utility abstracts the creation of chunks and small transactions and level 1 cache clearing so that the caller only need worry about coding the work to be done.
Author:
Jeff Fischer
  • Method Details

    • getPageSize

      int getPageSize()
      The result set size per page of data when streaming. See runStreamingTransactionalOperation(StreamCapableTransactionalOperation, Class).
      Returns:
    • setPageSize

      void setPageSize(int pageSize)
    • getRetryMax

      int getRetryMax()
    • setRetryMax

      void setRetryMax(int retryMax)
    • runStreamingTransactionalOperation

      <G extends Throwable> void runStreamingTransactionalOperation(StreamCapableTransactionalOperation streamOperation, Class<G> exceptionType) throws G
      Run a streaming operation inside a transaction. Uses the StreamCapableTransactionalOperation API to determine the page of data to work on within the transaction scope.
      Type Parameters:
      G -
      Parameters:
      streamOperation -
      exceptionType -
      Throws:
      G
    • runTransactionalOperation

      <G extends Throwable> void runTransactionalOperation(StreamCapableTransactionalOperation operation, Class<G> exceptionType, org.springframework.transaction.PlatformTransactionManager transactionManager) throws G
      Throws:
      G extends Throwable
    • runStreamingTransactionalOperation

      <G extends Throwable> void runStreamingTransactionalOperation(StreamCapableTransactionalOperation streamOperation, Class<G> exceptionType, int transactionBehavior, int isolationLevel) throws G
      Throws:
      G extends Throwable
    • runTransactionalOperation

      <G extends Throwable> void runTransactionalOperation(StreamCapableTransactionalOperation operation, Class<G> exceptionType) throws G
      Run an operation inside of a single transaction. This is not a streaming use case and represents a basic operation to perform in a transaction. See TransactionalOperation.execute().
      Type Parameters:
      G -
      Parameters:
      operation -
      exceptionType -
      Throws:
      G
    • runTransactionalOperation

      <G extends Throwable> void runTransactionalOperation(StreamCapableTransactionalOperation operation, Class<G> exceptionType, int transactionBehavior, int isolationLevel) throws G
      Throws:
      G extends Throwable
    • runOptionalTransactionalOperation

      <G extends Throwable> void runOptionalTransactionalOperation(StreamCapableTransactionalOperation operation, Class<G> exceptionType, boolean useTransaction) throws G
      Run an operation inside of a single transaction. This is not a streaming use case and represents a basic operation to perform in a transaction. See TransactionalOperation.execute(). The useTransaction parameter allows the inclusion of some logic to determine whether or not the creation of the transaction is required for the operation. This is useful in situations where there may already be an active transaction that you want to use, if available.
      Type Parameters:
      G -
      Parameters:
      operation -
      exceptionType -
      useTransaction -
      Throws:
      G
    • runOptionalTransactionalOperation

      <G extends Throwable> void runOptionalTransactionalOperation(StreamCapableTransactionalOperation operation, Class<G> exceptionType, boolean useTransaction, int transactionBehavior, int isolationLevel) throws G
      Throws:
      G extends Throwable
    • runOptionalTransactionalOperation

      <G extends Throwable> void runOptionalTransactionalOperation(StreamCapableTransactionalOperation operation, Class<G> exceptionType, boolean useTransaction, int transactionBehavior, int isolationLevel, boolean readOnly, org.springframework.transaction.PlatformTransactionManager transactionManager) throws G
      Throws:
      G extends Throwable
    • getTransactionManager

      org.springframework.transaction.PlatformTransactionManager getTransactionManager()
    • setTransactionManager

      void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
    • runOptionalEntityManagerInViewOperation

      void runOptionalEntityManagerInViewOperation(Runnable runnable)
      Executes the Runnable operation in the scope of an Entity-Manager-In-View pattern, if there is not already an EntityManager on the thread. This is useful for operations that may be susceptible to lazy init exceptions if there is not an EntityManager available on the thread.
      Parameters:
      runnable -