Enum Class UnitOfWork.Phase
- All Implemented Interfaces:
Serializable,Comparable<UnitOfWork.Phase>,Constable
- Enclosing interface:
UnitOfWork<T extends Message<?>>
Enum indicating possible phases of the Unit of Work.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionIndicates that the Unit of Work is after a successful commit.Indicates that the Unit of Work is after a successful commit or after a rollback.Indicates that the Unit of Work is at the end of its life cycle.Indicates that the Unit of Work has been committed and is passed thePREPARE_COMMITphase.Indicates that the unit of work has been created but has not been registered with theCurrentUnitOfWorkyet.Indicates that the Unit of Work is preparing its commit.Indicates that the Unit of Work is being rolled back.Indicates that the Unit of Work has been registered with theCurrentUnitOfWorkbut has not been committed, because its Message has not been processed yet. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisAfter(UnitOfWork.Phase phase) Check if this Phase comes after given otherphase.booleanisBefore(UnitOfWork.Phase phase) Check if this Phase comes before given otherphase.booleanCheck whether registered handlers for this phase should be invoked in the order of registration (first registered handler is invoked first) or in the reverse order of registration (last registered handler is invoked first).booleanCheck if a Unit of Work in this phase has been started, i.e. is registered with theCurrentUnitOfWork.booleanIndicates whether the handlers triggered for this phase should have their exceptions suppressed.static UnitOfWork.PhaseReturns the enum constant of this class with the specified name.static UnitOfWork.Phase[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NOT_STARTED
Indicates that the unit of work has been created but has not been registered with theCurrentUnitOfWorkyet. -
STARTED
Indicates that the Unit of Work has been registered with theCurrentUnitOfWorkbut has not been committed, because its Message has not been processed yet. -
PREPARE_COMMIT
Indicates that the Unit of Work is preparing its commit. This means thatUnitOfWork.commit()has been invoked on the Unit of Work, indicating that the MessageUnitOfWork.getMessage()of the Unit of Work has been processed. All handlers registered to be notified before commitUnitOfWork.onPrepareCommit(java.util.function.Consumer<org.axonframework.messaging.unitofwork.UnitOfWork<T>>)will be invoked. If no exception is raised by any of the handlers the Unit of Work will go into theCOMMITphase, otherwise it will be rolled back. -
COMMIT
Indicates that the Unit of Work has been committed and is passed thePREPARE_COMMITphase. -
ROLLBACK
Indicates that the Unit of Work is being rolled back. Generally this is because an exception was raised while processing themessageor while the Unit of Work was being committed. -
AFTER_COMMIT
Indicates that the Unit of Work is after a successful commit. In this phase the Unit of Work cannot be rolled back anymore. -
CLEANUP
Indicates that the Unit of Work is after a successful commit or after a rollback. Any resources tied to this Unit of Work should be released. -
CLOSED
Indicates that the Unit of Work is at the end of its life cycle. This phase is final.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
isStarted
public boolean isStarted()Check if a Unit of Work in this phase has been started, i.e. is registered with theCurrentUnitOfWork.- Returns:
trueif the Unit of Work is started when in this phase,falseotherwise
-
isReverseCallbackOrder
public boolean isReverseCallbackOrder()Check whether registered handlers for this phase should be invoked in the order of registration (first registered handler is invoked first) or in the reverse order of registration (last registered handler is invoked first).- Returns:
trueif the order of invoking handlers in this phase should be in the reverse order of registration,falseotherwise.
-
isSuppressHandlerErrors
public boolean isSuppressHandlerErrors()Indicates whether the handlers triggered for this phase should have their exceptions suppressed. This is the case for phases where cleanup or post-error processing is done. Exceptions in those phases should not trigger exceptions, but to a best-effort attempt to clean up.- Returns:
truewhen errors should be suppressed, otherwisefalse
-
isBefore
Check if this Phase comes before given otherphase.- Parameters:
phase- The other Phase- Returns:
trueif this comes before the givenphase,falseotherwise.
-
isAfter
Check if this Phase comes after given otherphase.- Parameters:
phase- The other Phase- Returns:
trueif this comes after the givenphase,falseotherwise.
-