org.qi4j.api.unitofwork
Class UnitOfWorkConcern

java.lang.Object
  extended by org.qi4j.api.concern.ConcernOf<InvocationHandler>
      extended by org.qi4j.api.concern.GenericConcern
          extended by org.qi4j.api.unitofwork.UnitOfWorkConcern
All Implemented Interfaces:
InvocationHandler

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

UnitOfWorkConcern manages the unit of work complete and discard policy.

See Also:
UnitOfWorkPropagation, UnitOfWorkDiscardOn

Field Summary
 
Fields inherited from class org.qi4j.api.concern.ConcernOf
next
 
Constructor Summary
UnitOfWorkConcern()
           
 
Method Summary
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.