public void stop() {
    if (expirationThread != null) {
      expirationThread.interrupt();
    }
    if (restartThread != null) {
      restartThread.interrupt();
    }
  }
Logic for the thread that tracks session expiration and restarts sessions in background.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/SessionExpirationTracker.java