private String checkQueueAccessFromSingleRm(String urlString) throws IOException {
    URL url = new URL(urlString);
    HttpURLConnection connection = UserGroupInformation.isSecurityEnabled() ?
        getSecureConnection(url) : (HttpURLConnection)url.openConnection();
    int statusCode = connection.getResponseCode();
    switch (statusCode) {
    case HttpStatus.SC_OK: return processResponse(connection);
    case HttpStatus.SC_FORBIDDEN: {
      // Throw a special exception since it's usually a well-known misconfiguration.
      throw new IOException(handleUnexpectedStatusCode(connection, statusCode, "check that the "
          + "HiveServer2 principal is in the administrator list of the root YARN queue"));
    }
    default: throw new IOException(handleUnexpectedStatusCode(connection, statusCode, null));
    }
  }
Checks yarn queue access of a given user for a given queue, and throws
HiveException in case the user doesn't have access to the queue.
@param  queueName the yarn queue name
@param  userName the username
@throws IOException when doAs throws an exception, we simply throw it
InterruptedException when doAs throws an exception, we simply throw it
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/YarnQueueHelper.java