[cdi-dev] [JBoss JIRA] (CDI-578) define behaviour of firing an event for an observer with transaction if the transaction is not open or marked rollback

Mark Struberg (JIRA) issues at jboss.org
Sat Jan 23 04:13:00 EST 2016


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

Mark Struberg commented on CDI-578:
-----------------------------------

added error handling for rollback and illegal state. 
The only technical thing which is missing is SystemException. But this indicates that there is some really low-level setup or container problem. Thus I think we should leave this out of the spec and the containers should just blow up with the Exception.

> define behaviour of firing an event for an observer with transaction if the transaction is not open or marked rollback
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: CDI-578
>                 URL: https://issues.jboss.org/browse/CDI-578
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>    Affects Versions: 1.2.Final
>            Reporter: Mark Struberg
>
> The original problem description can be found at https://issues.apache.org/jira/browse/OWB-1111
> If you have an observer 
> {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 the behaviour when firing the event if the underlying transaction is already closed or rolled back is totally undefined. It might blow up or continue silently depending on the server.
> The problem is that you cannot enlisten a Synchronisation at the tx anymore. 
> I think we should define/clarify how it should behave in the various phases.
> E.g. a during=AFTER_SUCCESS should NOT deliver the event immediately if the tx is already marked for rollback. But for AFTER_COMPLETION it might be perfectly fine.
> At the end we need a matrix of the the event phases + possible Exceptions



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the cdi-dev mailing list