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