Interface ThreadContextTransactionProvider

    • Method Detail

      • begin

        void begin()
        Begin a thread context bound transaction.
      • commit

        void commit()
        Commit current thread context bound transaction.
      • rollback

        void rollback()
        Rollback current thread context bound transaction.
      • runWithTransaction

        default <T> T runWithTransaction​(Function<Void,​T> procedure)
        Description copied from interface: TransactionProvider
        Begin a transaction that is committed when the procedure exists or rolled back if the procedure throws an RuntimeException. The value thrown by the procedure should be rethrown.
        Specified by:
        runWithTransaction in interface TransactionProvider<Void>
        Type Parameters:
        T - the type of the returned result
        Parameters:
        procedure - the procedure to run within a transaction returning a result
        Returns:
        the result of the procedure
      • runWithoutTransaction

        default <T> T runWithoutTransaction​(Function<Void,​T> procedure)
        Description copied from interface: TransactionProvider
        Acquire the result without wrapping the operation in a transaction. It is possible to define data access strictly in terms of Transactionals without forcing all interactions to be wrapped in transactions.

        A TransactionProvider implementation is not required to provide support for non-transactional procedures. In these cases the implementation should throw an UnsupportedOperationException.

        Specified by:
        runWithoutTransaction in interface TransactionProvider<Void>
        Type Parameters:
        T - the type of the returned result
        Parameters:
        procedure - the procedure to run with a non-transactional context
        Returns:
        the result of the procedure