public void startCacheUpdate() {
    try {
      DumbServiceImpl dumbService = DumbServiceImpl.getInstance(myProject);

      if (!ApplicationManager.getApplication().isUnitTestMode()) {
        // pre-startup activities have registered dumb tasks that load VFS (scanning files to index)
        // only after these tasks pass does VFS refresh make sense
        dumbService.queueTask(
            new DumbModeTask() {
              @Override
              public void performInDumbMode(@NotNull ProgressIndicator indicator) {
                scheduleInitialVfsRefresh();
              }

              @Override
              public String toString() {
                return "initial refresh";
              }
            });
      }
    } catch (ProcessCanceledException e) {
      throw e;
    } catch (Throwable e) {
      LOG.error(e);
    }
  }
  private void doUpdateOnRefresh() {
    if (ApplicationManager.getApplication().isUnitTestMode()
        && (!myStartupActivityPerformed || myProject.isDisposed())) {
      return; // in test mode suppress addition to a queue unless project is properly initialized
    }
    if (myProject.isDefault()) {
      return;
    }

    if (myDoLogCachesUpdate) LOG.info("refresh");
    DumbServiceImpl dumbService = DumbServiceImpl.getInstance(myProject);
    DumbModeTask task = FileBasedIndexProjectHandler.createChangedFilesIndexingTask(myProject);
    if (task != null) {
      dumbService.queueTask(task);
    }

    if (myRefreshCacheUpdaters.size() == 0) {
      return;
    }

    if (ourScheduleCacheUpdateInDumbMode) {
      dumbService.queueCacheUpdateInDumbMode(myRefreshCacheUpdaters);
    } else {
      dumbService.queueCacheUpdate(myRefreshCacheUpdaters);
    }
  }
  @Override
  protected void doSynchronizeRoots() {
    if (!myStartupActivityPerformed) return;

    if (myDoLogCachesUpdate) LOG.info(new Throwable("sync roots"));

    DumbServiceImpl dumbService = DumbServiceImpl.getInstance(myProject);
    dumbService.queueTask(new UnindexedFilesUpdater(myProject, false));

    if (myRootsChangeUpdaters.isEmpty()) return;

    if (ourScheduleCacheUpdateInDumbMode) {
      dumbService.queueCacheUpdateInDumbMode(myRootsChangeUpdaters);
    } else {
      dumbService.queueCacheUpdate(myRootsChangeUpdaters);
    }
  }