Hello,
I am using openorb, openorb transaction service, openorb implementation of JTA, and the XA classes provided by
postgresqlto execute distributed transactions.
When i use only one resource, the transaction commits properly (since the prepare() method does not get invoked), but
wheni use more then one resources in a global transaction, it seems that the prepare() call of the
org.postgresql.xa.XAConnectionImplthrows an XAException indicating that it was invoked in an improper context
(XAException.XAER_PROTO),which is caused by having the TxConnection.count > 0 condition. Here is a breief discription
onthe sequence of calls:
processA:
Create transaction (getting CosTransactions::Control)
cache it with some id.
processB: (different control of thread than processA created Control in)
get Control from processA for a specific ID.
resume CosTransactions::Current with that control.
Get XAConnection from org.postgressql.PostgresqlDataSource
register XAResource (from XAConnection) with JTA (the JTA implementation uses CosTransaction::Current to talk to the
distributedtransaction)
exercute some sql command using the connetion aquired from XAConnection
processC:
do the same as processB
processA: (after receiving notification from processB and processC about the completion of the task)
get the CosTransaction::Control for the id.
call commit.
When i call commit, it calls prepare() on the registered XAResources, but since the TxConnection.count is 1 it throws
theexception (described above)
However if i change the code (org.postgresql.xa.XAConnectionImpl.java: around line 670) that the comparison is
"txConn.count> 1" (instead of "txConn.count > 0") the transaction commits properly...
Any help is greatly apprechiated,
Thank you,
Zoltan Fulop