Package fi.jubic.easyutils.transactional
Interface TransactionProvider<C>
-
- Type Parameters:
C- the type of the transaction context
- All Known Subinterfaces:
ThreadContextTransactionProvider
public interface TransactionProvider<C>A provider interface for running 3rd party transactions within theTransactionalframework.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> TrunWithoutTransaction(Function<C,T> procedure)Acquire the result without wrapping the operation in a transaction.<T> TrunWithTransaction(Function<C,T> procedure)Begin a transaction that is committed when the procedure exists or rolled back if the procedure throws anRuntimeException.
-
-
-
Method Detail
-
runWithTransaction
<T> T runWithTransaction(Function<C,T> procedure)
Begin a transaction that is committed when the procedure exists or rolled back if the procedure throws anRuntimeException. The value thrown by the procedure should be rethrown.- 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
<T> T runWithoutTransaction(Function<C,T> procedure)
Acquire the result without wrapping the operation in a transaction. It is possible to define data access strictly in terms ofTransactionals without forcing all interactions to be wrapped in transactions.A
TransactionProviderimplementation is not required to provide support for non-transactional procedures. In these cases the implementation should throw anUnsupportedOperationException.- 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
-
-