[jboss-dev-forums] [Design of JCA on JBoss] - Re: [JBAS-5095] Race condition between connection.close() an

jesper.pedersen do-not-reply at jboss.com
Thu Aug 14 08:38:33 EDT 2008


I'm looking at TxConnectionManager::getManagedConnection().

Shouldn't there always be a check against if an active transaction exists ?

Currently we have:

  | Transaction tx = tm.getTransaction();
  | if (tx != null && TxUtils.isActive(tx) == false)
  |    throw new ResourceException("...");
  | 

But in case of a transaction hasn't been started tm.getTransaction() will return null.

So code should read:

  | Transaction tx = tm.getTransaction();
  | if (tx == null || TxUtils.isActive(tx) == false)
  |    throw new ResourceException("...");
  | 

The transaction will only be passed to BaseConnectionManager2 if track-by-tx is enabled in any case.

TxConnectionManager::checkTransactionActive() also doesn't check for a null value - the JavaDoc states that a RollbackException should be thrown if the transaction is not active.

Or am I overlooking something ?

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

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



More information about the jboss-dev-forums mailing list