[cdi-dev] [JBoss JIRA] (CDI-705) BEFORE_COMPLETION Transactional observer is notified for transaction which is marked for rollback

Antoine Sabot-Durand (JIRA) issues at jboss.org
Wed Jun 7 08:09:00 EDT 2017


    [ https://issues.jboss.org/browse/CDI-705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13417641#comment-13417641 ] 

Antoine Sabot-Durand commented on CDI-705:
------------------------------------------

Obviously, we introduced a mistake in CDI 2.0 by mentioning that transactional observers bound to {{BEFORE_COMPLETION}} phase should be called even if the transaction is rolled back or marked as rolled back. I plan to contact the EG to propose that we ignore this feature and align on JTA behaviour  (related [test|https://github.com/antoinesd/cdi-tck/blob/2092263827d68253e2a74c6150c387e829f0382f/impl/src/main/java/org/jboss/cdi/tck/tests/event/observer/transactional/roolback/TransactionalObserverRollbackTest.java] in TCK should also be ignored and this ticket will have to be corrected in a coming CDI 2.0 MR IMO.

> BEFORE_COMPLETION Transactional observer is notified for transaction which is marked for rollback
> -------------------------------------------------------------------------------------------------
>
>                 Key: CDI-705
>                 URL: https://issues.jboss.org/browse/CDI-705
>             Project: CDI Specification Issues
>          Issue Type: Bug
>          Components: Events
>    Affects Versions: 2.0 .Final
>            Reporter: Tomas Remes
>
> In {{10.4.5. Transactional observer methods}} CDI spec states:
> {quote}
> 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.
> {quote}
> This doesn't conform to JTA spec, which says in {{3.3.2 Transaction Synchronization}}:
> {quote}
> 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.
> {quote}
> 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. 



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the cdi-dev mailing list