org.qi4j.api.unitofwork.concern

## Class UnitOfWorkConcern

- java.lang.Object
- - org.qi4j.api.concern.ConcernOf<InvocationHandler>
  - - org.qi4j.api.concern.GenericConcern
    - - org.qi4j.api.unitofwork.concern.UnitOfWorkConcern

- All Implemented Interfaces:
    InvocationHandler

      @AppliesTo(value=UnitOfWorkPropagation.class)
      public class UnitOfWorkConcern
      extends GenericConcern

  `UnitOfWorkConcern` manages the unit of work complete, discard and retry policy.
  See Also:
    `UnitOfWorkPropagation`, `UnitOfWorkDiscardOn`

- - ### Field Summary

    - ### Fields inherited from class org.qi4j.api.concern.ConcernOf

      `next`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UnitOfWorkConcern()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `discardIfRequired(Method aMethod, UnitOfWork aUnitOfWork, Throwable aThrowable)` Discard unit of work if the discard policy match.
    `Object` | `invoke(Object proxy, Method method, Object[] args)` Handles method with `UnitOfWorkPropagation` annotation.
    `protected Object` | `invokeWithCommit(Object proxy, Method method, Object[] args, UnitOfWork currentUnitOfWork)`

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

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

- - ### Constructor Detail

    - #### UnitOfWorkConcern

          public UnitOfWorkConcern()

  - ### Method Detail

    - #### invoke

          public Object invoke(Object proxy,
                      Method method,
                      Object[] args)
                        throws Throwable

      Handles method with `UnitOfWorkPropagation` annotation.
      Parameters:
        `proxy` - The object.
        `method` - The invoked method.
        `args` - The method arguments.
      Returns:
        The returned value of method invocation.
      Throws:
        `Throwable` - Thrown if the method invocation throw exception.

    - #### invokeWithCommit

          protected Object invokeWithCommit(Object proxy,
                                Method method,
                                Object[] args,
                                UnitOfWork currentUnitOfWork)
                                     throws Throwable

      Throws:
        `Throwable`

    - #### discardIfRequired

          protected void discardIfRequired(Method aMethod,
                               UnitOfWork aUnitOfWork,
                               Throwable aThrowable)

      Discard unit of work if the discard policy match.
      Parameters:
        `aMethod` - The invoked method. This argument must not be `null`.
        `aUnitOfWork` - The current unit of work. This argument must not be `null`.
        `aThrowable` - The exception thrown. This argument must not be `null`.