[
https://issues.apache.org/jira/browse/DERBY-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474521
]
Daniel John Debrunner commented on DERBY-2360:
----------------------------------------------
I think this behaviour comes from "Distributed Transaction Processing: The XA
Specification"
http://www.opengroup.org/onlinepubs/009680699/toc.pdf
>From page 38 (51 in the pdf doc)
-----------------------------------------
TMFAIL
The portion of work has failed. A resource manager might choose to mark a
transaction branch as rollback-only at this point. In fact, a transaction
manager
does so for the global transaction. If a resource manager chooses to do so also,
xa_end() returns one of the [XA_RB*] values. TMFAIL cannot be used in
conjunction with either TMSUSPEND or TMSUCCESS.
-------------------------------------------
So the resource manager deciding the transaction is rollback only has to return
one of the XA_RB values.
In JTA the only way to return such values is to throw an XAException with the
XA_RB* error code.
> The XAResource.end(xid, XAResource.TMFAIL) does not work
> --------------------------------------------------------
>
> Key: DERBY-2360
> URL: https://issues.apache.org/jira/browse/DERBY-2360
> Project: Derby
> Issue Type: Bug
> Affects Versions: 10.3.0.0
> Environment: Solaris Nevada build 56, sun jdk 1.6
> Reporter: Julius Stroffek
> Assigned To: Julius Stroffek
>
> If I execute this peace of code
> Xid xid = createXid(9,11);
> xaRes.start(xid, XAResource.TMNOFLAGS);
> Statement stm = conn.createStatement();
> stm.execute("create table NumberTable2 (i int)");
> stm.execute("insert into NumberTable2 values (1)");
> xaRes.end(xid, XAResource.TMFAIL);
> xaRes.rollback(xid);
> I get the following exception
> 1)
> testXAConnection(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)javax.transaction.xa.XAException
> at org.apache.derby.jdbc.EmbedXAResource.end(EmbedXAResource.java:208)
> at
> org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testXAConnection(XATransactionTest.java:94)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:76)
> at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
> at junit.extensions.TestSetup.run(TestSetup.java:25)
> at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
> at junit.extensions.TestSetup.run(TestSetup.java:25)
>
> If I change TMFAIL to TMSUCCESS, everything works. The end with TMFAIL shoudl
> do the same as with TMSUCCESS except that I can only rollback the transaction.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.