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 ofCompensatingTransactionOperationExecutor
objects and performs rollback of these in the reverse order.- Since:
- 1.2
-
-
Constructor Summary
Constructors Constructor Description DefaultCompensatingTransactionOperationManager(CompensatingTransactionOperationFactory operationFactory)
Set theCompensatingTransactionOperationFactory
to use.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
commit()
Commit all recorded operations.protected java.util.Stack<CompensatingTransactionOperationExecutor>
getOperationExecutors()
Get the rollback operations.void
performOperation(java.lang.Object resource, java.lang.String operation, java.lang.Object[] args)
Indicates that the supplied operation (method name) is to be performed.void
rollback()
Rollback all recorded operations by performing each of the recorded rollback operations.
-
-
-
Constructor Detail
-
DefaultCompensatingTransactionOperationManager
public DefaultCompensatingTransactionOperationManager(CompensatingTransactionOperationFactory operationFactory)
Set theCompensatingTransactionOperationFactory
to 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:CompensatingTransactionOperationManager
Indicates 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:
performOperation
in 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:CompensatingTransactionOperationManager
Rollback all recorded operations by performing each of the recorded rollback operations.- Specified by:
rollback
in 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:CompensatingTransactionOperationManager
Commit all recorded operations. In many cases this means doing nothing, but in some cases some temporary data will need to be removed.- Specified by:
commit
in interfaceCompensatingTransactionOperationManager
-
-