Interface TransactionSupport


  • public interface TransactionSupport
    Interface implemented by the job implementation provider. Implementations are instantiated via ServiceLoader.
    Since:
    1.0.0
    Author:
    Christian Beikov
    • Field Detail

      • NOOP

        static final TransactionSupport NOOP
        The no-op transaction support that has no transactional support. This is the default.
    • Method Detail

      • transactional

        <T> T transactional​(JobContext context,
                            long transactionTimeoutMillis,
                            boolean joinIfPossible,
                            Callable<T> callable,
                            Consumer<Throwable> exceptionHandler)
        Runs the given callable in a transaction with the given transaction timeout. If desired, will join an already running transaction, otherwise, will suspend an already running transaction and start a new one. If an exception happens in the callable, the exception handler is invoked.
        Type Parameters:
        T - The result type of the callable
        Parameters:
        context - The job context
        transactionTimeoutMillis - The transaction timeout
        joinIfPossible - Whether to join an existing transaction or create a new one
        callable - The callable to execute within the transaction
        exceptionHandler - The exception handler to invoke if an exception occurs
        Returns:
        the result of the callable
      • registerPostCommitListener

        void registerPostCommitListener​(Runnable o)
        Registers the given runnable to run after a commit.
        Parameters:
        o - The runnable to run after a commit