This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I wrote a JCA resource adapter for an ECM back-end system (Enterprise Content Management). I included support for XA transactions.
I was wondering how a JEE server is managing connections who are enlisted in a XA transaction. I wrote a web application which is using the resource adpater (RA). Let's assume that I have a servlet that performs the following actions:
2. do something with RA
5. do something again with RA
All actions are performed inside a XA transaction (started and committed in a servlet filter).
Let's assume that two requests A and B are processed at more or less the same time. Request A finished step 3, then comes request B and does step 4: is it possible that request B gets the connection that was just closed by request A? Or does the JEE container guarantee that this will not happen?
I did some tests with WebSphere 8 that seem to suggest that WebSphere will not give the connection of request A to request B while the transaction is in progress, which is what I expected. But I need to be sure this will never happen. I couldn't find a definite answer in the JCA specs either.