private void cancelTokens(List<TokenWrapper> tokensToCancel) {
    ListIterator<TokenWrapper> tokensIt = tokensToCancel.listIterator();
    while (tokensIt.hasNext()) {
      TokenWrapper token = tokensIt.next();
      try {
        secretManager.cancelToken(token.realToken, clusterUser);
        tokensIt.remove();
      } catch (IOException e) {
        LOG.warn("Cannot cancel token while shutting down (on IOException): " + token + ", giving up", e);
      }
    }
  }
Convenience wrapper for llap tokens, that decodes max lifetime only once on adding and maintains expiration time.
llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/DefaultLlapTokenManager.java