org.springframework.transaction.compensating.support

## 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
  Author:
    Mattias Hellborg Arthursson

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultCompensatingTransactionOperationManager(CompensatingTransactionOperationFactory operationFactory)` Set the `CompensatingTransactionOperationFactory` to use.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `commit()` Commit all recorded operations.
    `protected Stack<CompensatingTransactionOperationExecutor>` | `getOperationExecutors()` 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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultCompensatingTransactionOperationManager

          public DefaultCompensatingTransactionOperationManager(CompensatingTransactionOperationFactory operationFactory)

      Set the `CompensatingTransactionOperationFactory` to use.
      Parameters:
        `operationFactory` - the `CompensatingTransactionOperationFactory`.

  - ### Method Detail

    - #### performOperation

          public void performOperation(Object resource,
                                       String operation,
                                       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 interface `CompensatingTransactionOperationManager`
      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 interface `CompensatingTransactionOperationManager`

    - #### getOperationExecutors

          protected 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 interface `CompensatingTransactionOperationManager`