File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes JCA Connection pool and transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JCA Connection pool and transactions" Watch "JCA Connection pool and transactions" New topic

JCA Connection pool and transactions

Hicham Bahi

Joined: Aug 29, 2011
Posts: 2
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:

1. getConnection()
2. do something with RA
3. close()
4. getConnection()
5. do something again with RA
6. close()

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.

Any help would be appreciated.
Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

This is the reason why anyone would want to use a JEE container. Don't you think so?

Not many get the right opportunity !
sam sepassi

Joined: Sep 23, 2012
Posts: 7
Refer to java connector architecture specification 1.6 chapter 7.
Read connection sharing section .
Consider Paul's rocket mass heater.
subject: JCA Connection pool and transactions
jQuery in Action, 3rd edition