In 10.4.5. Transactional observer methods CDI spec states:
If the transaction is in progress, but javax.transaction.Synchronization callback cannot be
registered due to the transaction being already marked for rollback or in state where
javax.transaction.Synchronization callbacks cannot be registered, the before completion, after completion and after failure observer methods are notified at the same time as other observers, but after_success observer methods get skipped.
This doesn't conform to JTA spec, which says in 3.3.2 Transaction Synchronization:
The Synchronization.beforeCompletion method is called prior to the
start of the two-phase transaction commit process. This call is executed with
the transaction context of the transaction that is being committed.
So the before_completion transactional observer shouldn't be notified for transaction marked for rollback.
The method Synchronization.beforeCompletion is actually not called at WildFly and GlassFish app servers for transaction which is marked for rollback.
- relates to
-
CDITCK-587 TransactionalObserverRollbackTest wrongly assumes that beforeCompletion synchronization callback is called for rollbacked tx
- Open
-
CDI-578 define behaviour of firing an event for an observer with transaction if the transaction is not open or marked rollback
- Resolved