[jboss-dev] JTA question for the transaction gurus

Tim Fox tim.fox at jboss.com
Thu Jan 11 14:53:59 EST 2007


If I have at least 2 participants enlisted in a JTA tx and call commit, 
then the commit fails, e.g. due to network problems say due to the 
XAResource being enable to contact it's server.

In this case is it possible the commit fails and the TRansaction is left 
in state Status.STATUS_PREPARING?

Basically I have this situation:

I am have a JTA transaction where 2 JMS XAResources are enlisted 
corresponding to two different servers.

I am acking some messages on one server and sending some messages on the 
other (basically this is a message bridge).

If the network fails, the bridge should be able to catch exceptions and 
retry until the network comes back up.

If the failure occurs during the Transaction.commit() call, then I only 
want to retry the commit if the transaction didn't get prepared, since 
if it got to the prepare stage then the transaction recovery (hopefully) 
will commit it eventually.

So I am checking Transaction.getStatus() after the failure to work out 
whether to retry commit or not. Basically my assumption is I should 
retry after failure if the tx is not prepared.

Is this a correct approach?



-- 
Tim Fox
JBoss Messaging Technical Lead
JBoss - a division of Red Hat
T: +44 2088006768
M: +44 7957983205
E: tim.fox at jboss.com tim.fox at redhat.com



More information about the jboss-development mailing list