Interface TransactionManager
-
public interface TransactionManager
Wraps given action with transaction. If an exception is thrown, then rollback is executed.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static TransactionManager
getInstance(Session session)
Creates new instance of Transaction Managervoid
withTransaction(Runnable action)
Wraps given action with transaction.void
withTransaction(Runnable action, Function<Throwable,RuntimeException> exceptionMapper)
Wraps given action with transaction.
-
-
-
Method Detail
-
withTransaction
void withTransaction(Runnable action)
Wraps given action with transaction. If an exception is thrown, then rollback is executed. The exception is rethrown after rollback.- Parameters:
action
- action to be executed
-
withTransaction
void withTransaction(Runnable action, Function<Throwable,RuntimeException> exceptionMapper)
Wraps given action with transaction. If an exception is thrown, then rollback is executed. After rollback, the exception is mapped into a custom exception using exceptionMapper and rethrown.- Parameters:
action
- action to be executedexceptionMapper
- function that maps caught exception into custom exception
-
getInstance
static TransactionManager getInstance(Session session)
Creates new instance of Transaction Manager- Parameters:
session
- snowpark session- Returns:
- new instance
-
-