org.qi4j.api.unitofwork
Class UnitOfWorkConcern
java.lang.Object
org.qi4j.api.concern.ConcernOf<InvocationHandler>
org.qi4j.api.concern.GenericConcern
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UnitOfWorkConcern
public UnitOfWorkConcern()
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
.