Package org.apache.cayenne.tx
Class DefaultTransactionManager
- java.lang.Object
-
- org.apache.cayenne.tx.DefaultTransactionManager
-
- All Implemented Interfaces:
TransactionManager
public class DefaultTransactionManager extends Object implements TransactionManager
- Since:
- 4.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DefaultTransactionManager.BaseTransactionHandler
-
Constructor Summary
Constructors Constructor Description DefaultTransactionManager(TransactionFactory txFactory, JdbcEventLogger jdbcEventLogger)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DefaultTransactionManager.BaseTransactionHandler
getHandler(TransactionDescriptor descriptor)
<T> T
performInTransaction(TransactionalOperation<T> op)
Starts a new transaction (or joins an existing one) callingTransactionalOperation.perform()
, and then committing or rolling back the transaction.<T> T
performInTransaction(TransactionalOperation<T> op, TransactionDescriptor descriptor)
Performs operation in a transaction which parameters described by descriptor.<T> T
performInTransaction(TransactionalOperation<T> op, TransactionListener callback)
Starts a new transaction (or joins an existing one) callingTransactionalOperation.perform()
, and then committing or rolling back the transaction.<T> T
performInTransaction(TransactionalOperation<T> op, TransactionListener callback, TransactionDescriptor descriptor)
Performs operation in a transaction which parameters described by descriptor.
-
-
-
Constructor Detail
-
DefaultTransactionManager
public DefaultTransactionManager(TransactionFactory txFactory, JdbcEventLogger jdbcEventLogger)
-
-
Method Detail
-
performInTransaction
public <T> T performInTransaction(TransactionalOperation<T> op)
Description copied from interface:TransactionManager
Starts a new transaction (or joins an existing one) callingTransactionalOperation.perform()
, and then committing or rolling back the transaction.- Specified by:
performInTransaction
in interfaceTransactionManager
- Type Parameters:
T
- returned value type- Parameters:
op
- an operation to perform within the transaction.- Returns:
- a value returned by the "op" operation.
-
performInTransaction
public <T> T performInTransaction(TransactionalOperation<T> op, TransactionListener callback)
Description copied from interface:TransactionManager
Starts a new transaction (or joins an existing one) callingTransactionalOperation.perform()
, and then committing or rolling back the transaction. As transaction goes through stages, callback methods are invoked allowing the caller to customize transaction parameters.- Specified by:
performInTransaction
in interfaceTransactionManager
- Type Parameters:
T
- returned value type- Parameters:
op
- an operation to perform within the transaction.callback
- a callback to notify as transaction progresses through stages.- Returns:
- a value returned by the "op" operation.
-
performInTransaction
public <T> T performInTransaction(TransactionalOperation<T> op, TransactionDescriptor descriptor)
Description copied from interface:TransactionManager
Performs operation in a transaction which parameters described by descriptor.- Specified by:
performInTransaction
in interfaceTransactionManager
- Type Parameters:
T
- result type- Parameters:
op
- an operation to perform within the transaction.descriptor
- transaction descriptor- Returns:
- a value returned by the "op" operation.
- Since:
- 4.1
-
performInTransaction
public <T> T performInTransaction(TransactionalOperation<T> op, TransactionListener callback, TransactionDescriptor descriptor)
Description copied from interface:TransactionManager
Performs operation in a transaction which parameters described by descriptor. As transaction goes through stages, callback methods are invoked allowing the caller to customize transaction parameters.- Specified by:
performInTransaction
in interfaceTransactionManager
- Type Parameters:
T
- returned value type- Parameters:
op
- an operation to perform within the transaction.callback
- a callback to notify as transaction progresses through stages.descriptor
- transaction descriptor- Returns:
- a value returned by the "op" operation.
- Since:
- 4.1
-
getHandler
protected DefaultTransactionManager.BaseTransactionHandler getHandler(TransactionDescriptor descriptor)
-
-