Class CompensatableActionImpl
- java.lang.Object
-
- org.jboss.narayana.compensations.internal.CompensatableActionImpl
-
- All Implemented Interfaces:
CompensatableAction
@Dependent public class CompensatableActionImpl extends Object implements CompensatableAction
- Author:
- Gytis Trikleris
-
-
Constructor Summary
Constructors Constructor Description CompensatableActionImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompensatableAction
addWork(CompensatableWork compensatableWork, CompensationHandler compensationHandler)
Add a piece of work to the action with a compensation handler.CompensatableAction
addWork(CompensatableWork compensatableWork, CompensationHandler compensationHandler, ConfirmationHandler confirmationHandler)
Add a piece of work to the action with a compensation and a confirmation handlers.CompensatableAction
addWork(CompensatableWork compensatableWork, ConfirmationHandler confirmationHandler)
Add a piece of work to the action with a confirmation handler.void
execute()
Execute all registered work pieces one by one.
-
-
-
Method Detail
-
addWork
public CompensatableAction addWork(CompensatableWork compensatableWork, CompensationHandler compensationHandler)
Description copied from interface:CompensatableAction
Add a piece of work to the action with a compensation handler.- Specified by:
addWork
in interfaceCompensatableAction
- Parameters:
compensatableWork
- Work that needs to be executed atomically.compensationHandler
- Handler which needs to be invoked in case of failure to undo the work.- Returns:
- this instance of CompensatableAction.
-
addWork
public CompensatableAction addWork(CompensatableWork compensatableWork, ConfirmationHandler confirmationHandler)
Description copied from interface:CompensatableAction
Add a piece of work to the action with a confirmation handler.- Specified by:
addWork
in interfaceCompensatableAction
- Parameters:
compensatableWork
- Work that needs to be executed atomically.confirmationHandler
- Handler which needs to be invoked if action is completed successfully.- Returns:
- this instance of CompensatableAction
-
addWork
public CompensatableAction addWork(CompensatableWork compensatableWork, CompensationHandler compensationHandler, ConfirmationHandler confirmationHandler)
Description copied from interface:CompensatableAction
Add a piece of work to the action with a compensation and a confirmation handlers.- Specified by:
addWork
in interfaceCompensatableAction
- Parameters:
compensatableWork
- Work that needs to be executed atomically.compensationHandler
- Handler which needs to be invoked in case of failure to undo the work.confirmationHandler
- Handler which needs to be invoked if action is completed successfully.- Returns:
- this instance of CompensatableAction
-
execute
public void execute() throws EnlistException
Description copied from interface:CompensatableAction
Execute all registered work pieces one by one.- Specified by:
execute
in interfaceCompensatableAction
- Throws:
EnlistException
- Is thrown if action fails to register any handler with the transaction.
-
-