[jboss-dev-forums] [JBoss Transactions Development] - Regression on setRollbackOnly
Carlo de Wolf
do-not-reply at jboss.com
Fri Jun 18 05:11:14 EDT 2010
Carlo de Wolf [http://community.jboss.org/people/wolfc] created the discussion
"Regression on setRollbackOnly"
To view the discussion, visit: http://community.jboss.org/message/548668#548668
--------------------------------------------------------------
With the introduction of https://jira.jboss.org/browse/JBTM-234 https://jira.jboss.org/browse/JBTM-234 we see regression on EJB 3 testsuites when setRollbackOnly is called from afterCompletion. We expect to get an IllegalStateException, instead a SystemException is thrown.
As the issue states OTS raises Inactive:
> +OTS 1.4 2.6.14 rollback_only+
> The transaction associated with the target object is modified so that the only possible
> outcome is to rollback the transaction. The *Inactive* exception is raised if the
> transaction has already been prepared.
While the JTA spec doesn't explicitly account for such a scenario.
To recount:
> void *beforeCompletion*()
>
> The beforeCompletion method is called by the transaction manager 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.
>
>
> void *afterCompletion*(int status)
>
> This method is called by the transaction manager after the transaction is committed or rolled back.
>
And
> The aftercompletion callback will be invoked in an undefined context.
> void *setRollbackOnly*() throws java.lang.IllegalStateException, http://download.oracle.com/docs/cd/E17410_01/javaee/6/api/javax/transaction/SystemException.html SystemException
> IllegalStateException - Thrown if the target object is not associated with any transaction.
> SystemException - Thrown if the transaction manager encounters an unexpected error condition.
Now it really becomes a choice which exception should be thrown.
> public class *SystemException* extends java.lang.Exception
>
> The SystemException is thrown by the transaction manager to indicate that it has encountered an unexpected error condition that prevents future transaction services from proceeding.
In principal both the state of the transaction and transaction services are not compromised and transaction services proceeds in a defined manner. The outcome of the transaction is the status as passed into the afterCompletion.
Based on the description in SystemException I would say that TS should *not* throw that exception, but instead the IllegalStateException.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/548668#548668]
Start a new discussion in JBoss Transactions Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2041]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20100618/eab7f591/attachment.html
More information about the jboss-dev-forums
mailing list