[jboss-dev-forums] [Design of JCA on JBoss] - Re: connection management on tx timeout

adrian@jboss.org do-not-reply at jboss.com
Mon Dec 15 07:59:25 EST 2008


"jhalliday" wrote : A couple of questions related to JBAS-5080, i.e. how connections behave if used either side of a asynchronous transaction timeout.
  | 
  | Am I right that the expected behaviour of a connection handle obtained in a transaction but subsequently used after that transaction has been rolled back on another thread, is that it should behave as if closed? The JIRA is not too clear on what the actual fix was.
  | 

It will throw a RollbackException (wrapped in an SQLException) if you try to use
the connection or one of its child objects (e.g. a statement) 
after the transaction is aborted.

anonymous wrote : 
  | Now the more difficult one: what's the expected JCA behaviour when a Thread that has a transaction context representing an aborted transaction, asks for a new connection? This happens if a transaction timeouts and is rolled back in the background, then the application logic tries to obtain a new connection. The new connection should be part of the ongoing global tx, but that tx is dead. Hopefully the getConnection call will throw an exception if the tx state is other than active?
  | 

Correct. The pool does a check early to avoid unnecessary allocation of a connection, 
but the real definitive test is when it tries to do the Transaction.enlistResource()

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4196547#4196547

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4196547



More information about the jboss-dev-forums mailing list