Class DefaultCompensatingTransactionOperationManager
java.lang.Object
org.springframework.transaction.compensating.support.DefaultCompensatingTransactionOperationManager
- All Implemented Interfaces:
CompensatingTransactionOperationManager
public class DefaultCompensatingTransactionOperationManager
extends Object
implements CompensatingTransactionOperationManager
Default implementation of
CompensatingTransactionOperationManager
. Manages a
stack of CompensatingTransactionOperationExecutor
objects and performs rollback
of these in the reverse order.- Since:
- 1.2
-
Constructor Summary
ConstructorDescriptionDefaultCompensatingTransactionOperationManager
(CompensatingTransactionOperationFactory operationFactory) Set theCompensatingTransactionOperationFactory
to use. -
Method Summary
Modifier and TypeMethodDescriptionvoid
commit()
Commit all recorded operations.protected Stack<CompensatingTransactionOperationExecutor>
Get the rollback operations.void
performOperation
(Object resource, String operation, 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 Details
-
DefaultCompensatingTransactionOperationManager
public DefaultCompensatingTransactionOperationManager(CompensatingTransactionOperationFactory operationFactory) Set theCompensatingTransactionOperationFactory
to use.- Parameters:
operationFactory
- theCompensatingTransactionOperationFactory
.
-
-
Method Details
-
performOperation
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
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
-