Been looking at the SearcherManager code to fix my code so that it doesn't close an IndexReader whilst still being used , but everytime I look at the SearchManager code it appears it will never close it, am I misunderstaning something or is there a typo

This is how I see it

When an IndexSearcher from a reader is created getRef() returns 1
So a subsequent call to close for indexSearcher.getIndexReader() would reduce ref to zero and it would close.

In the SearchServer code, the ref count is increase on every usage via get() and decreased once finished with using release(). BUT the maybeReopen() method also calls get(), so even if the reader wasn't being used it refcount() would then be 2 and the so the call to release() within maybeReopen() will only take it down to one not zero, and hence it will never actually be closed ?

Paul



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to