You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Romain Manni-Bucau (JIRA)" <ji...@apache.org> on 2016/01/15 13:48:39 UTC

[jira] [Commented] (OWB-1111) firing a during-transaction event fails if the tx is already rolled back or not active

    [ https://issues.apache.org/jira/browse/OWB-1111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15101724#comment-15101724 ] 

Romain Manni-Bucau commented on OWB-1111:
-----------------------------------------

Using Synchronization semantic we should respect Synchronization behavior so register before a rollback but the issue is then the sender (fire()) needs to know it be used with JTA or not. All in between/fallback strategy seems to lead to hard to understand and surprising behavior to me.

> firing a during-transaction event fails if the tx is already rolled back or not active
> --------------------------------------------------------------------------------------
>
>                 Key: OWB-1111
>                 URL: https://issues.apache.org/jira/browse/OWB-1111
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Java EE Integration
>    Affects Versions: 1.2.8, 1.6.2
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>             Fix For: 1.6.3
>
>
> Consider you have an observer method like
> {code}
> public void clearCacheAfterTx(@Observes(during=TransactionPhase.AFTER_COMPLETION) ClearAfterTx payload) {...}
> {code}
> and you fire the event
> {code}
> clearCacheEvent.fire(new ClearCacheEvent());
> {code}
> In this case firing the event currently blows up if the underlying transaction is already closed or rolled back. This happens because the transaction spec states that you cannot register a tx Synchronisation in certain states:
> https://docs.oracle.com/javaee/6/api/javax/transaction/Transaction.html#registerSynchronization%28javax.transaction.Synchronization%29



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)