mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-06 10:59:12 +00:00
IndexReader#addReaderCloseListener is very error prone when it comes to caching and reader wrapping. The listeners are not delegated to the sub readers nor can it's implementation change since it's final in the base class. This commit only allows installing close listeners on the top level ElasticsearchDirecotryReader which is known to work an has a defined lifetime which corresponds to its subreader. This ensure that cachesa re cleared once the reader goes out of scope.