private void stopOrDisconnectTezSessions() {
    LOG.info("Stopping/Disconnecting tez sessions.");
    // There should already be an instance of the session pool manager.
    // If not, ignoring is fine while stopping HiveServer2.
    if (tezSessionPoolManager != null) {
      try {
        tezSessionPoolManager.stop();
        LOG.info("Stopped tez session pool manager.");
      } catch (Exception e) {
        LOG.error("Error while stopping tez session pool manager.", e);
      }
    }
    if (wm != null) {
      try {
        wm.stop();
        LOG.info("Stopped workload manager.");
      } catch (Exception e) {
        LOG.error("Error while stopping workload manager.", 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