@Override
  protected @NotNull Collection<ThrowableRunnable<?>> prepareTasks() {
    // PersistentFS lifecycle should contain FileBasedIndex lifecycle, so,
    // 1) we call for it's instance before index creation to make sure it's initialized
    // 2) we dispose FileBasedIndex before PersistentFS disposing
    PersistentFSImpl fs = (PersistentFSImpl)ManagingFS.getInstance();
    FileBasedIndexImpl fileBasedIndex = (FileBasedIndexImpl)FileBasedIndex.getInstance();
    Disposable disposable = new ShutdownTaskAsDisposable();
    ApplicationManager.getApplication().addApplicationListener(new MyApplicationListener(fileBasedIndex), disposable);
    Disposer.register(fs, disposable);
    //Generally, Index will be shutdown by Disposer -- but to be sure, we'll register a shutdown task also:
    myFileBasedIndex.setUpShutDownTask();

    myCurrentVersionCorrupted = CorruptionMarker.requireInvalidation();
    for (FileBasedIndexInfrastructureExtension extension : FileBasedIndexInfrastructureExtension.EP_NAME.getExtensionList()) {
      FileBasedIndexInfrastructureExtension.InitializationResult result = extension.initialize(IndexStorageLayoutLocator.getCustomLayoutId());
      myCurrentVersionCorrupted = myCurrentVersionCorrupted ||
                                  result == FileBasedIndexInfrastructureExtension.InitializationResult.INDEX_REBUILD_REQUIRED;
    }

    if (myCurrentVersionCorrupted) {
      CorruptionMarker.dropIndexes();
      ApplicationManager.getApplication().getService(AppIndexingDependenciesService.class).invalidateAllStamps("Indexes corrupted");
    }

    myOrphanDirtyFilesQueue = PersistentDirtyFilesQueue.readOrphanDirtyFilesQueue(PersistentDirtyFilesQueue.getQueueFile(), ManagingFS.getInstance().getCreationTimestamp());
    Collection<ThrowableRunnable<?>> tasks = initAssociatedDataForExtensions(myOrphanDirtyFilesQueue);

    PersistentIndicesConfiguration.loadConfiguration();

    return tasks;
  }
@Override
  protected @NotNull Collection<ThrowableRunnable<?>> prepareTasks()