public synchronized void decommission() {
    LOG.info("Decommissioning HiveServer2");
    // Remove this server instance from ZooKeeper if dynamic service discovery is set
    if (zooKeeperHelper != null && !isDeregisteredWithZooKeeper()) {
      try {
        zooKeeperHelper.removeServerInstanceFromZooKeeper();
      } catch (Exception e) {
        LOG.error("Error removing znode for this HiveServer2 instance from ZooKeeper.", e);
      }
    }
    String pidDir = StringUtils.defaultIfEmpty(System.getenv("HIVESERVER2_PID_DIR"),
        System.getenv("HIVE_CONF_DIR"));
    if (StringUtils.isNotEmpty(pidDir)) {
      File pidFile = new File(pidDir, "hiveserver2.pid");
      LOG.info("Deleting the tmp HiveServer2 pid file: {}", pidFile);
      FileUtils.deleteQuietly(pidFile);
    }
    super.decommission();
  }
Decommission HiveServer2. As a consequence, SessionManager stops
opening new sessions, OperationManager refuses running new queries and
HiveServer2 deregisters itself from Zookeeper if service discovery is enabled,
but the decommissioning has no effect on the current running queries.
service/src/java/org/apache/hive/service/server/HiveServer2.java