use new disposable instance in FileBasedIndexDataInitialization#prepareTasks instead of a lambda

GitOrigin-RevId: 6fe856d96e4e4ce11c90b3f03b891f8fecc3fa05
This commit is contained in:
Daniil Ovchinnikov
2022-07-27 15:58:55 +00:00
committed by intellij-monorepo-bot
parent c58915eca8
commit 7fffa465a2
@@ -111,7 +111,13 @@ final class FileBasedIndexDataInitialization extends IndexDataInitializer<IndexC
// 2) we dispose FileBasedIndex before PersistentFS disposing
PersistentFSImpl fs = (PersistentFSImpl)ManagingFS.getInstance();
FileBasedIndexImpl fileBasedIndex = (FileBasedIndexImpl)FileBasedIndex.getInstance();
Disposable disposable = () -> new FileBasedIndexImpl.MyShutDownTask().run();
// anonymous class is required to make sure the new instance is created
Disposable disposable = new Disposable() {
@Override
public void dispose() {
new FileBasedIndexImpl.MyShutDownTask().run();
}
};
ApplicationManager.getApplication().addApplicationListener(new MyApplicationListener(fileBasedIndex), disposable);
Disposer.register(fs, disposable);
myFileBasedIndex.setUpShutDownTask();