public <T> T executeCallable(Callable<T> callable) throws Exception {
    long startTime = System.currentTimeMillis();
    long delay = this.initialDelayInSeconds;
    Exception previousException = null;
    while(true) {
      try {
        if (UserGroupInformation.isSecurityEnabled()) {
          SecurityUtils.reloginExpiringKeytabUser();
          return UserGroupInformation.getLoginUser().doAs((PrivilegedExceptionAction<T>) () -> callable.call());
        } else {
          return callable.call();
        }
      } catch (Exception e) {
        if (this.failOnParentExceptions.stream().noneMatch(k -> k.isAssignableFrom(e.getClass()))
          && this.failOn.stream().noneMatch(k -> e.getClass().equals(k))
          && this.retryOn.stream().anyMatch(k -> e.getClass().isAssignableFrom(k))) {
          if (elapsedTimeInSeconds(startTime) + delay > this.totalDurationInSeconds) {
            // case where waiting would go beyond max duration. So throw exception and return
            throw e;
          }
          sleep(delay);
          //retry case. compute next sleep time
          delay = getNextDelay(delay, previousException, e);
          // reset current captured exception.
          previousException = e;
        } else {
          // Exception cannot be retried on. Throw exception and return
          throw e;
        }
      }
    }
  }
Class to implement any retry logic in case of exceptions.
ql/src/java/org/apache/hadoop/hive/ql/exec/util/Retryable.java