//roll back for onePhase only. for 2pc, rollback only is processed in prepare
if ((tx != null) && tx.isRollbackOnly() && onePhase)
{
this.rollback(xid, tx, connection);
throw new MessagingXAException(XAException.XA_RBROLLBACK, "Transaction marked rollback only, xid: " + xid);
}
if (onePhase)
{
//Invalid xid
if (tx == null)
{
throw new MessagingXAException(XAException.XAER_NOTA, "Cannot find transaction with xid:" + xid);
}
TransactionRequest request =
new TransactionRequest(TransactionRequest.ONE_PHASE_COMMIT_REQUEST, null, tx);
request.state = tx;
sendTransactionXA(request, connection);
}
else
{
if (tx != null)
{
if (tx.getState() != ClientTransaction.TX_PREPARED)
{
throw new MessagingXAException(XAException.XAER_PROTO, "commit called for transaction, but it is not prepared");
}
}
else
{
//It's possible we don't actually have the prepared tx here locally - this