public void unregisterDag(String dir, String applicationIdString, int dagIdentifier) {
    Integer currentDagIdentifier = registeredApps.get(applicationIdString);
    // Unregister may come in after the new dag has started running. The methods are expected to
    // be synchronized, hence the following check is sufficient.
    if (currentDagIdentifier != null && currentDagIdentifier.equals(dagIdentifier)) {
      registeredApps.remove(applicationIdString);
      registeredDirectories.remove(applicationIdString);
      removeJobShuffleInfo(applicationIdString);
    }
    // Unregister for the dirWatcher for the specific dagIdentifier in either case.
    if (dirWatcher != null) {
      dirWatcher.unregisterDagDir(dir, applicationIdString, dagIdentifier);
    }
  }
Unregister a specific dag

This method and registerDag must be synchronized externally to prevent races in shuffle token registration/unregistration

@param dir
@param applicationIdString
@param dagIdentifier
llap-server/src/java/org/apache/hadoop/hive/llap/shufflehandler/ShuffleHandler.java