@Override
  public void run() {

    // Region currRegion=null;
    Cache cache;
    int tblIDFld;
    String tblNameFld;
    // boolean to_continue = true;
    final int XA_INSERTS = 2;

    // get the cache
    // this is used to get the context for transaction later in the same method
    cache = TxnManagerMultiThreadDUnitTest.getCache();

    // get the table name from CacheUtils
    String tblName = CacheUtils.getTableName();

    tblIDFld = 1;
    tblNameFld = "thdOneCommit";

    // initialize cache and get user transaction
    Context ctx = cache.getJNDIContext();
    UserTransaction ta = null;
    Connection xa_conn = null;
    try {
      ta = (UserTransaction) ctx.lookup("java:/UserTransaction");
      // ta.setTransactionTimeout(300);
    } catch (NamingException nme) {
      nme.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }

    try {
      DataSource d1 = (DataSource) ctx.lookup("java:/SimpleDataSource");
      Connection con = d1.getConnection();
      con.close();
      // Begin the user transaction
      ta.begin();

      // Obtain XAPooledDataSource
      DataSource da = (DataSource) ctx.lookup("java:/XAPooledDataSource");

      // obtain connection from XAPooledDataSource
      xa_conn = da.getConnection();

      Statement xa_stmt = xa_conn.createStatement();

      String sqlSTR;

      // get the unique value for key to be inserted
      int uniqueKey = getUniqueKey();

      // insert XA_INSERTS rows into timestamped table
      for (int i = 0; i < XA_INSERTS; i++) {
        tblIDFld = tblIDFld + uniqueKey + i;
        sqlSTR =
            "insert into " + tblName + " values (" + tblIDFld + "," + "'" + tblNameFld + "'" + ")";
        // log.info("Thread= "+Thread.currentThread()+" ... sqlStr= "+ sqlSTR + "Before update");
        xa_stmt.executeUpdate(sqlSTR);
        // log.info("Thread= "+Thread.currentThread()+" ... sqlStr= "+ sqlSTR + "after update");
      }

      // close the Simple and XA statements
      xa_stmt.close();

      // close the connections
      xa_conn.close();

      // log.info("Thread Before Commit..."+Thread.currentThread());

      // rollback the transaction
      ta.rollback();

    } catch (NamingException nme) {
      nme.printStackTrace();
    } catch (SQLException sqle) {
      sqle.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (xa_conn != null) {
        try {
          // close the connections
          xa_conn.close();
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }

    log.info(XA_INSERTS + ": Rows were inserted and rolled back successfully");
  }
This is thread class The objective of this thread class is to implement the inserts and rollback
This thread will be called from TxnManagerMultiThreadDUnitTest.java This is to test the
concurrent execution of the run method and see if transaction manager handles it properly
geode-core/src/distributedTest/java/org/apache/geode/internal/jta/dunit/RollbackThread.java