private void applyModifications(@NotNull VirtualFile file,
                                  int indexerFilter,
                                  @Nullable AtomicInteger syncCounter,
                                  @Nullable Runnable finishCallback,
                                  @NotNull String debugThreadString) {
    var startTime = System.nanoTime();
    boolean allModificationsSuccessful = true;
    try {
      for (SingleIndexValueApplier<?> applier : appliers) {
        if (indexerFilter < 0 || indexerFilter == getExecutorIndex(applier.indexId)) {
          boolean applied = applier.apply();
          if (!applied) {
            allModificationsSuccessful = false;
            VfsEventsMerger.tryLog("NOT_APPLIED", file, () -> applier.toString());
          }
        }
      }

      for (SingleIndexValueRemover remover : removers) {
        if (indexerFilter < 0 || indexerFilter == getExecutorIndex(remover.indexId)) {
          boolean removed = remover.remove();
          if (!removed) {
            allModificationsSuccessful = false;
            VfsEventsMerger.tryLog("NOT_REMOVED", file, () -> remover.toString());
          }
        }
      }
    }
    catch (ProcessCanceledException pce) {
      allModificationsSuccessful = false;
      if (FileBasedIndexEx.TRACE_STUB_INDEX_UPDATES) {
        Logger.getInstance(FileIndexesValuesApplier.class)
          .infoWithDebug("applyModifications interrupted,fileId=" + fileId + "," + pce, new RuntimeException(pce));
      }
      throw pce;
    }
    catch (Throwable t) {
      allModificationsSuccessful = false;
      Logger.getInstance(FileIndexesValuesApplier.class)
        .warn("applyModifications interrupted,fileId=" + fileId + "," + t, FileBasedIndexEx.TRACE_STUB_INDEX_UPDATES ? t : null);
      throw t;
    }
    finally {
      var lastOrOnlyInvocationForFile = syncCounter == null || syncCounter.decrementAndGet() == 0;
      Supplier<String> debugString =
        () -> " updated_indexes=" + stats.getPerIndexerEvaluateIndexValueTimes().keySet() +
              " deleted_indexes=" + stats.getPerIndexerEvaluatingIndexValueRemoversTimes().keySet();

      if (lastOrOnlyInvocationForFile) {
        doPostModificationJob(file, allModificationsSuccessful, debugString);
      }
      else {
        VfsEventsMerger.tryLog("HAS_MORE_MODIFICATIONS", file, debugString);
      }
      separateApplicationTimeNanos.addAndGet(System.nanoTime() - startTime);
      if (lastOrOnlyInvocationForFile && finishCallback != null) {
        finishCallback.run();
      }
    }
  }
private void applyModifications(@NotNull VirtualFile file,
                                  int indexerFilter,
                                  @Nullable AtomicInteger syncCounter,
                                  @Nullable Runnable finishCallback,
                                  @NotNull String debugThreadString)