//if tx is mark rollback, roll back immediately
if (tx.isRollbackOnly())
{
this.rollbackLocal(xid, tx);
throw new MessagingTransactionRolledBackException("Rolled back " + tx + " as it is marked rollback only!");
}
TransactionRequest request =
new TransactionRequest(TransactionRequest.ONE_PHASE_COMMIT_REQUEST, null, tx);
try
{
connection.sendTransaction(request, false);
// If we get this far we can remove the transaction
if (this.removeTxInternal(xid) == null)
{
throw new IllegalStateException("Cannot find xid to remove " + xid);
}
}
catch (JMSSecurityException e)
{
// If a security exception happens, just rethrow it
throw e;
}
catch (Throwable t)
{
// If a problem occurs during commit processing the session should be rolled back
rollbackLocal(xid);
JMSException e = new MessagingTransactionRolledBackException(t.getMessage());
e.initCause(t);
throw e;
}
}