private void initAndStartTezSessionPoolManager(final WMFullResourcePlan resourcePlan) {
    // starting Tez session pool in start here to let parent session state initialize on CliService state, to avoid
    // SessionState.get() return null during createTezDir
    try {
      // will be invoked anyway in TezTask. Doing it early to initialize triggers for non-pool tez session.
      LOG.info("Initializing tez session pool manager. Active resource plan: {}",
        resourcePlan == null || resourcePlan.getPlan() == null ? "null" : resourcePlan.getPlan().getName());
      tezSessionPoolManager = TezSessionPoolManager.getInstance();
      HiveConf hiveConf = getHiveConf();
      if (hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_TEZ_INITIALIZE_DEFAULT_SESSIONS)) {
        tezSessionPoolManager.setupPool(hiveConf);
      } else {
        tezSessionPoolManager.setupNonPool(hiveConf);
      }
      tezSessionPoolManager.startPool(hiveConf, resourcePlan);
      LOG.info("Tez session pool manager initialized.");
    } catch (Exception e) {
      throw new ServiceException("Unable to setup tez session pool", e);
    }
  }
@return true if the server instance was deregistered from ZooKeeper, else false. The function might
be called even when the instance is not registered with the ZooKeeper (See
SessionManage.closeSessionInternal()). In that case, return false since the deregistration has
not really happened.
service/src/java/org/apache/hive/service/server/HiveServer2.java