OrientDB, JCA, XA Transactions

187 views
Skip to first unread message

Markus Menner

unread,
Dec 11, 2013, 4:54:33 AM12/11/13
to orient-...@googlegroups.com
Hi all,

I'm using Harald Wellmann 's wonderful JCA adapter together with OrientDB 1.6.1, to manage transactions across one SQL DB (H2) and OrientDB.
The last resource commit optimization allows to use one resource that supports only LocalTransations within a global (XA) transaction.

Now, generally everything works fine, but if an exception occurs during OrientDB's commit() things start to become difficult.
An exception might occur for example, if timeouts for locking resources are reached, optimistic locking fails, etc.
In that case to my best knowledge one should simply retry the whole transaction.

One of the difficulties there is that the resource manager (at least the one inside Glassfish) does not forward it to the calling code, but replaces it by an XAException, which leads to the situation that your calling code is not able to detect whether it is an ONeedRetryException or not.
However, that can be managed by simply remembering the last exception thrown during a commit inside the JCA adapter's ManagedConnection, which is kind of really clumsy, but works.

A second difficulty is the fact that (again at least inside Glassfish) an exception during the commit of the resource with the LocalTransaction will NOT lead to a rollback on the other involved resources (I digged in Glassfish's code to determine the way exceptions during commits are handled).

Is there is a possibility to execute the parts of the OrientDB commit() that might lead to the exceptions mentioned above in advance, such that those can be handled prior the commit()?

I know that this sounds like having a 2pc, which might not exist now. If so, is there any activity on the implementation of 2pc?

Thanks,
Markus


André Gomes

unread,
Jan 15, 2014, 2:53:14 PM1/15/14
to orient-...@googlegroups.com
Hi, Markus!

Have you managed to get XA-Transactions working with OrientDB?

I'm looking for a way to inject a reference to orientdb in CDI Beans and use it in container managed (XA) transactions.

Do you think this is possible?

Regards,

André.

Manoj Neelapu

unread,
Feb 27, 2014, 1:34:22 AM2/27/14
to orient-...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages