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