@Override
  protected void requestRebuild(@NotNull Throwable ex) {
    Runnable action = () -> FileBasedIndex.getInstance().requestRebuild((ID<?, ?>)myIndexId, ex);
    Application app = ApplicationManager.getApplication();
    if (app.isUnitTestMode() || app.isHeadlessEnvironment()) {
      // avoid deadlock due to synchronous update in DumbServiceImpl#queueTask
      app.invokeLater(action);
    }
    else if (app.isReadAccessAllowed()) {
      IndexDataInitializer.submitGenesisTask(() -> {
        action.run();
        return null;
      });
    }
    else {
      action.run();
    }
  }
@Override
  protected void requestRebuild(@NotNull Throwable ex)