-
Notifications
You must be signed in to change notification settings - Fork 786
Closed
Labels
Milestone
Description
Reusing searchers as introduced in #1186 has some drawbacks:
- The map of SearcherManagers grows indefinitely (however not really fast)
- Once project is deleted and restored again, it can't be searched without webapp restart
These problems are cause by the multithreaded application and that the configuration change can arrive at anytime.
I suggest considering following solution which should theoretically work:
- subclass IndexSearcher and add get+set methods for an instance of SearcherManager
- adapt the ThreadPoolSearcherFactory so it returns the new subclass
- when acquiring new IndexSearcher from the manager, cast it to the subclass and inject the manager
- when releasing do similarly and release the searcher
This technique should not have the problem with the unbounded map - the closed instance of SearcherManager can be removed from the map while every acquired IndexSearcher already holds the instance of SearcherManager where it should return itself. Also it should solve the problem with deleted+restored projects as SearcherManager for deleted project could be immediately removed from the map.
tarzanek