docs: @Override
    public void rollback(Xid xid) throws XAException {
      if (LOGGER.isLoggable(Level.FINEST)) {
        debug("rolling back xid = " + xid);
      }
  
      // We don't explicitly check precondition 1.
  
      try {
        if (currentXid != null && currentXid.equals(xid)) {
          state = State.IDLE;
          currentXid = null;
          conn.rollback();
          conn.setAutoCommit(localAutoCommitMode);
        } else {
          String s = RecoveredXid.xidToString(xid);
  
          conn.setAutoCommit(true);
          Statement stmt = conn.createStatement();
          try {
            stmt.executeUpdate("ROLLBACK PREPARED '" + s + "'");
          } finally {
            stmt.close();
          }
        }
        committedOrRolledBack = true;
      } catch (SQLException ex) {
        int errorCode = XAException.XAER_RMERR;
        if (PSQLState.UNDEFINED_OBJECT.getState().equals(ex.getSQLState())) {
          if (committedOrRolledBack || !xid.equals(preparedXid)) {
            if (LOGGER.isLoggable(Level.FINEST)) {
              debug("rolling back xid " + xid + " while the connection prepared xid is " + preparedXid
                  + (committedOrRolledBack ? ", but the connection was already committed/rolled-back" : ""));
            }
            errorCode = XAException.XAER_NOTA;
          }
        }
        if (PSQLState.isConnectionError(ex.getSQLState())) {
          if (LOGGER.isLoggable(Level.FINEST)) {
            debug("rollback connection failure (sql error code " + ex.getSQLState() + "), reconnection could be expected");
          }
          errorCode = XAException.XAER_RMFAIL;
        }
        throw new PGXAException(GT.tr("Error rolling back prepared transaction. rollback xid={0}, preparedXid={1}, currentXid={2}", xid, preparedXid), ex, errorCode);
      }
    }