This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JCA Connection pool and transactions

 
Hicham Bahi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the reason why anyone would want to use a JEE container. Don't you think so?
 
sam sepassi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Refer to java connector architecture specification 1.6 chapter 7.
Read connection sharing section .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic