private void startInitialSession(SessionType session) throws Exception {
    boolean isUsable = session.tryUse(true);
    if (!isUsable) throw new IOException(session + " is not usable at pool startup");
    session.getConf().set(TezConfiguration.TEZ_QUEUE_NAME, session.getQueueName());
    configureAmRegistry(session);
    session.open();
    if (session.stopUsing()) {
      if (!putSessionBack(session, false)) {
        LOG.warn("Couldn't add a session during initialization");
        try {
          session.close(false);
        } catch (Exception ex) {
          LOG.error("Failed to close an unneeded session", ex);
        }
      }
    }
  }
Puts session back into the pool.
@return true if the session has been put back; false if it's not needed and should be killed.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionPool.java