Class DefaultCompensatingTransactionOperationManager
- java.lang.Object
-
- org.springframework.transaction.compensating.support.DefaultCompensatingTransactionOperationManager
-
- All Implemented Interfaces:
CompensatingTransactionOperationManager
public class DefaultCompensatingTransactionOperationManager extends java.lang.Object implements CompensatingTransactionOperationManager
Default implementation ofCompensatingTransactionOperationManager. Manages a stack ofCompensatingTransactionOperationExecutorobjects and performs rollback of these in the reverse order.- Since:
- 1.2
-
-
Constructor Summary
Constructors Constructor Description DefaultCompensatingTransactionOperationManager(CompensatingTransactionOperationFactory operationFactory)Set theCompensatingTransactionOperationFactoryto use.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommit()Commit all recorded operations.protected java.util.Stack<CompensatingTransactionOperationExecutor>getOperationExecutors()Get the rollback operations.voidperformOperation(java.lang.Object resource, java.lang.String operation, java.lang.Object[] args)Indicates that the supplied operation (method name) is to be performed.voidrollback()Rollback all recorded operations by performing each of the recorded rollback operations.
-
-
-
Constructor Detail
-
DefaultCompensatingTransactionOperationManager
public DefaultCompensatingTransactionOperationManager(CompensatingTransactionOperationFactory operationFactory)
Set theCompensatingTransactionOperationFactoryto use.- Parameters:
operationFactory- theCompensatingTransactionOperationFactory.
-
-
Method Detail
-
performOperation
public void performOperation(java.lang.Object resource, java.lang.String operation, java.lang.Object[] args)Description copied from interface:CompensatingTransactionOperationManagerIndicates that the supplied operation (method name) is to be performed. This method is responsible for recording the current state (prior to the operation), performing the operation, and storing the necessary information to roll back or commit the performed operation.- Specified by:
performOperationin interfaceCompensatingTransactionOperationManager- Parameters:
resource- the target resource to perform the operation on.operation- The method to be invoked.args- Arguments supplied to the method.
-
rollback
public void rollback()
Description copied from interface:CompensatingTransactionOperationManagerRollback all recorded operations by performing each of the recorded rollback operations.- Specified by:
rollbackin interfaceCompensatingTransactionOperationManager
-
getOperationExecutors
protected java.util.Stack<CompensatingTransactionOperationExecutor> getOperationExecutors()
Get the rollback operations. Used for testing purposes.- Returns:
- the rollback operations.
-
commit
public void commit()
Description copied from interface:CompensatingTransactionOperationManagerCommit all recorded operations. In many cases this means doing nothing, but in some cases some temporary data will need to be removed.- Specified by:
commitin interfaceCompensatingTransactionOperationManager
-
-