@Override
  public void close() throws HiveSQLException {
    try {
      acquire(true, false);
      cancelDelegationToken();
    } finally {
      release(true, false);
      try {
        super.close();
      } finally {
        try {
          FileSystem.closeAllForUGI(sessionUgi);
        } catch (IOException ioe) {
          throw new HiveSQLException("Could not clean up file-system handles for UGI: "
              + sessionUgi, ioe);
        }
      }
    }
  }
Close the file systems for the session and remove it from the FileSystem cache.
Cancel the session's delegation token and close the metastore connection
service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java