@Override
    protected Result getRow(final Get get, final long rowKeyBase, final byte[] cf) {
      PrivilegedExceptionAction<Object> action = new PrivilegedExceptionAction<Object>() {

        @Override
        public Object run() throws Exception {
          Result res = null;
          Table localTable = null;
          try {
            int mod = ((int) rowKeyBase % userNames.length);
            if (userVsTable.get(userNames[mod]) == null) {
              localTable = connection.getTable(tableName);
              userVsTable.put(userNames[mod], localTable);
              res = localTable.get(get);
            } else {
              localTable = userVsTable.get(userNames[mod]);
              res = localTable.get(get);
            }
          } catch (IOException ie) {
            LOG.warn("Failed to get the row for key = [" + Bytes.toString(get.getRow())
              + "], column family = [" + Bytes.toString(cf) + "]", ie);
          }
          return res;
        }
      };

      if (userNames != null && userNames.length > 0) {
        int mod = ((int) rowKeyBase % userNames.length);
        User user;
        UserGroupInformation realUserUgi;
        try {
          if (!users.containsKey(userNames[mod])) {
            if (User.isHBaseSecurityEnabled(conf)) {
              realUserUgi = KerberosUtils.loginAndReturnUGI(conf, userNames[mod]);
            } else {
              realUserUgi = UserGroupInformation.createRemoteUser(userNames[mod]);
            }
            user = User.create(realUserUgi);
            users.put(userNames[mod], user);
          } else {
            user = users.get(userNames[mod]);
          }
          Result result = (Result) user.runAs(action);
          return result;
        } catch (Exception ie) {
          LOG.warn("Failed to get the row for key = [" + Bytes.toString(get.getRow())
            + "], column family = [" + Bytes.toString(cf) + "]", ie);
        }
      }
      // This means that no users were present
      return null;
    }
Maps user with Table instance. Because the table instance has to be created per user inorder to
work in that user's context
hbase-diagnostics/src/main/java/org/apache/hadoop/hbase/util/MultiThreadedUpdaterWithACL.java