This content has been marked as final.
Show 1 reply
-
1. XA Transaction propagation within many threads
mmusgrov Mar 14, 2011 2:21 PM (in response to dro_k)I haven't tried this out myself but it sounds like you need to manage transaction association and enlistment of the database resources yourself from each thread. For example:
TransactionManager txnManager = lookup the transaction manager (eg via jndi)
Transaction txn = txnManager.getTransaction()
XADataSource xaDataSource1 = lookup data source for db1
XAConnection xaConnection1 = xaDataSource1.getXAConnection()
XAResource xaResource1 = xaConnection1.getXAResource()
and similarly for db2 and db3
and in each thread:
txnManager.resume(txn);
txn.enlistResource(xaResource1)
and similarly for the other two resources