lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Taylor <paul_t...@fastmail.fm>
Subject Is Searcher Manager in Lucene in Action 2nd Edition Correct ?
Date Thu, 03 Nov 2011 15:57:26 GMT
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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message