{
connection.sendTransaction(request, false);
}
catch (JMSSecurityException security)
{
MessagingXAException xaEx = new MessagingXAException(XAException.XA_RBROLLBACK, "A security exception happend!", security);
log.error(xaEx, xaEx);
throw xaEx;
}
catch (Throwable t)
{
//Catch anything else
//We assume that any error is recoverable - and the recovery manager should retry again
//either after the network connection has been repaired (if that was the problem), or
//the server has been fixed.
//(In some cases it will not be possible to fix so the user will have to manually resolve the tx)
if (request.getRequestType() == TransactionRequest.TWO_PHASE_PREPARE_REQUEST)
{
String oldBehaviour = System.getProperty("retain.oldxabehaviour");
if (oldBehaviour != null)
{
//Therefore we throw XA_RETRY
//Note we DO NOT throw XAER_RMFAIL or XAER_RMERR since both if these will cause the Arjuna
//tx mgr NOT to retry and the transaction will have to be resolve manually.
throw new MessagingXAException(XAException.XA_RETRY, "A Throwable was caught in sending the transaction", t);
}
else
{
//https://jira.jboss.org/jira/browse/JBMESSAGING-1734
throw new MessagingXAException(XAException.XA_RBCOMMFAIL, "A Throwable was caught in sending the transaction", t);
}
}
else if (request.getRequestType() == TransactionRequest.ONE_PHASE_COMMIT_REQUEST)
{
//for one-phase commit, we may have a rollback exeption
if (t instanceof XAException)
{
throw new MessagingXAException(XAException.XA_RBOTHER, "A Throwable was caught in sending one phase commit", t);
}
else
{
throw new MessagingXAException(XAException.XA_RETRY, "A Throwable was caught in sending one phase commit", t);
}
}
else
{
throw new MessagingXAException(XAException.XA_RETRY, "A Throwable was caught in sending the transaction", t);
}
}
}