[
https://issues.apache.org/jira/browse/DERBY-2220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12472838
]
Knut Anders Hatlen commented on DERBY-2220:
-------------------------------------------
Hi Julo,
I don't know enough about XA to answer your questions, but I have some general
comments to the patch:
I might be missing something, but doesn't this part of abortTransactions()
cause a NullPointerException?
+ Xid[] xids = null;
+ Collection coll = this.xids.values();
+ if (coll != null && coll.size() > 0) {
+ xids = (Xid []) coll.toArray(xids);
When calling coll.toArray(xids), xids is always null, isn't it? Also, I think
abortTransactions() would be simpler if it used xids.values().iterator()
directly instead of converting the collection to an array.
I'm not sure I see the value of the removeXid parameter to
rollbackTransaction(). It might micro-optimize abortTransactions(), but given
that abortTransaction() is only invoked in exceptional situations, I don't
think it justifies the extra complexity.
The patch makes some of the lines in DRDAXAProtocol exceed 80 characters, which
should be avoided.
> Uncommitted transactions executed throught XAResource will held locks after
> the application terminates (or crashes during the transaction).
> -------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-2220
> URL: https://issues.apache.org/jira/browse/DERBY-2220
> Project: Derby
> Issue Type: Bug
> Affects Versions: 10.3.0.0
> Environment: Solaris Nevada build 49, Sun's JDK1.6
> Reporter: Julius Stroffek
> Assigned To: Julius Stroffek
> Attachments: d2220_beta.diff, d2220_beta2.diff, XATranTest.java,
> xxx.sql
>
>
> Using this piece of code derby will not release a table lock of 'dummy' table.
> String query = "insert into dummy (field1) values ('" +
> Integer.toString(value) + "')";
> XAConnection xaConnection =
> createXAConnection("jdbc:derby://localhost:1527/TestDB", "", "");
> XAResource xaResource = xaConnection.getXAResource();
> conn = xaConnection.getConnection();
>
> Xid xid = createXid(value);
> xaResource.setTransactionTimeout(10);
> xaResource.start(xid, XAResource.TMNOFLAGS);
>
> Statement statement = conn.createStatement();
> statement.execute(query);
>
> // terminate the client application
> // this will not release any locks
> System.exit(0);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.