public void rollback() throws IllegalStateException, SystemException {
    LogWriter writer = TransactionUtils.getLogWriter();
    try {
      XAResource xar = null;
      XAResource xar1 = null;
      int loop = 0;
      synchronized (resourceMap) {
        Iterator iterator = resourceMap.entrySet().iterator();
        Boolean isActive = Boolean.FALSE;
        Map.Entry entry;
        while (iterator.hasNext()) {
          try {
            entry = (Map.Entry) iterator.next();
            xar = (XAResource) entry.getKey();
            isActive = (Boolean) entry.getValue();
            if (loop == 0) {
              xar1 = xar;
            }
            loop++;
            if (isActive) {
              // delistResource(xar, XAResource.TMSUCCESS);
              xar.end(xid, XAResource.TMSUCCESS);
              entry.setValue(Boolean.FALSE);
            }
          } catch (Exception e) {
            if (VERBOSE) {
              writer.info("GlobalTransaction::rollback:Exception in delisting XAResource", e);
            }
          }
        }
      }
      if (xar1 != null) {
        xar1.rollback(xid);
      }
      status = Status.STATUS_ROLLEDBACK;
      if (VERBOSE) {
        writer.fine("Transaction rolled back successfully");
      }
    } catch (Exception e) {
      // we will throw an error later, make sure that the synchronizations rollback
      status = Status.STATUS_ROLLEDBACK;
      String exception =
          String.format(
              "GlobalTransaction::rollback:Rollback not successful due to exception %s %s",
              e, " " + (e instanceof XAException
                  ? ("Error Code =" + ((XAException) e).errorCode) : ""));
      if (VERBOSE) {
        writer.fine(exception);
      }
      SystemException sysEx = new SystemException(exception);
      sysEx.initCause(e);
      throw sysEx;
    } finally {
      // Map globalTransactions = tm.getGlobalTransactionMap();
      TransactionManagerImpl.getTransactionManager().cleanGlobalTransactionMap(transactions);
      // Asif : Clear the list of transactions
      transactions.clear();
    }
  }
Delists the XAResources associated with the Global Transaction and Roll back the transaction
associated with the current thread.

Concurrency: Some paths invoke this method after taking a lock on "this" while other paths
invoke this method without taking a lock on "this". Since both types of path do act on the
resourceMap collection, it is being protected by a lock on resourceMap too.

@throws java.lang.SecurityException - Thrown to indicate that the thread is not allowed to roll
        back the transaction.
@throws java.lang.IllegalStateException - Thrown if the current thread is not associated with a
        transaction.
@throws SystemException - Thrown if the transaction manager encounters an unexpected error
        condition.

@see javax.transaction.TransactionManager#rollback()
geode-core/src/main/java/org/apache/geode/internal/jta/GlobalTransaction.java