<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Regression on setRollbackOnly
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/wolfc">Carlo de Wolf</a> in <i>JBoss Transactions Development</i> - <a href="http://community.jboss.org/message/548668#548668">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>With the introduction of <a class="jive-link-external-small" href="https://jira.jboss.org/browse/JBTM-234">https://jira.jboss.org/browse/JBTM-234</a> we see regression on EJB 3 testsuites when setRollbackOnly is called from afterCompletion. We expect to get an IllegalStateException, instead a SystemException is thrown.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>As the issue states OTS raises Inactive:</p><blockquote class="jive-quote"><p><em>OTS 1.4 2.6.14 rollback_only</em><br/>The transaction associated with the target object is modified so that the only possible<br/>outcome is to rollback the transaction. The <strong>Inactive</strong> exception is raised if the<br/>transaction has already been prepared.</p></blockquote><p>While the JTA spec doesn't explicitly account for such a scenario.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>To recount:</p><blockquote class="jive-quote"><pre>void <strong>beforeCompletion</strong>()</pre>
<br/>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.<br/><br/><br/>
<pre>void <strong>afterCompletion</strong>(int status)</pre>
<br/>This method is called by the transaction  manager after the transaction is committed or rolled back.<br/></blockquote><p>And</p><blockquote class="jive-quote"><p>The aftercompletion callback will be invoked in an undefined context.</p></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><blockquote class="jive-quote"><pre>void <strong>setRollbackOnly</strong>() throws java.lang.IllegalStateException, <a class="jive-link-external-small" href="http://download.oracle.com/docs/cd/E17410_01/javaee/6/api/javax/transaction/SystemException.html">SystemException</a><br/><br/><code>IllegalStateException</code> - Thrown if the target object is not associated with any transaction.<br/><code>SystemException</code> - Thrown if the transaction manager encounters an unexpected error condition.</pre>
<br/></blockquote><p>Now it really becomes a choice which exception should be thrown.</p><blockquote class="jive-quote"><pre>public class <strong>SystemException </strong>extends java.lang.Exception</pre>
<br/>
<p>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.</p>
<br/></blockquote><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Based on the description in SystemException I would say that TS should <strong>not </strong>throw that exception, but instead the IllegalStateException.</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/548668#548668">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Transactions Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2041">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>