You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Julius Stroffek (JIRA)" <ji...@apache.org> on 2007/02/21 14:21:05 UTC
[jira] Commented: (DERBY-2360) The XAResource.end(xid,
XAResource.TMFAIL) throws an exception
[ https://issues.apache.org/jira/browse/DERBY-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474694 ]
Julius Stroffek commented on DERBY-2360:
----------------------------------------
I checked the Apache Geronimo (http://geronimo.apache.org/) and the implementation code for javax.transaction.Transaction.delistResource looks as (in a class org.apache.geronimo.transaction.manager.TransactionImpl)
try {
xaRes.end(manager.getBranchId(), flag);
if (flag == XAResource.TMSUSPEND) {
suspendedXaResources.put(xaRes, manager);
}
return true;
} catch (XAException e) {
log.warn("Unable to delist XAResource " + xaRes + ", error code: " + e.errorCode, e);
return false;
}
So, If I will pass a TMFAIL in flags I will get an exception that the transaction manager is not able to delist the resource.
I also checked JOTM on ObjectWeb (http://jotm.objectweb.org/) and the corresponding code for javax.transaction.Transaction.delistResource which can be found in org.objectweb.jotm.TranasctionImpl.java is
// Send the XA end to the XAResource
try {
xares.end (myjavaxxid, flag);
// xares.end( (javax.transaction.xa.Xid) resXid, flag );
} catch (XAException e) {
String error =
"Cannot send XA end:"
+ e
+ " (error code = "
+ e.errorCode
+ ") --"
+ e.getMessage();
TraceTm.jotm.error(error);
if (TraceTm.jta.isDebugEnabled()) {
TraceTm.jotm.debug("xares.end= " + xares);
}
throw new SystemException(error);
}
which also propagates the exception thrown in XAResource.end with TMFAIL flag as an error to the application.
> The XAResource.end(xid, XAResource.TMFAIL) throws an exception
> --------------------------------------------------------------
>
> 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.