if (tx == null) { log.error("Cannot find transaction with xid:" + xid); throw new XAException(XAException.XAER_NOTA); }
   public void rollback(Xid xid, ConnectionDelegate connection) throws XAException   {      if (log.isTraceEnabled()) { log.trace("Rolling back xid: " + xid); }      TxState tx = removeTx(xid);      if (tx == null)      {         log.error("Cannot find transaction with xid:" + xid);                  throw new XAException(XAException.XAER_NOTA);      }                  TransactionRequest request = null;            //We don't need to send the messages to the server on a rollback      tx.clearMessages();            if (tx.getState() == TxState.TX_PREPARED)      {         request = new TransactionRequest(TransactionRequest.TWO_PHASE_ROLLBACK_REQUEST, xid, tx);      }       else      {         request = new TransactionRequest(TransactionRequest.ONE_PHASE_ROLLBACK_REQUEST, xid, tx);      }            sendTransactionXA(request, connection);   }