if (onePhase)
{
//Invalid xid
if (tx == null)
{
throw new MessagingXAException(XAException.XAER_NOTA, "Cannot find transaction with xid:" + xid);
}
checkAndRollbackXA(tx, 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