Re: IndexReader.close() behavior

2011-05-13 Thread Mindaugas Žakšauskas
Hi, In my quest to fight a similar problem, I ended up writing a wrapper finalizer (sic!) that simply closes the underlying reader/searcher. It might be against all advices (e.g. "Effective Java 2ed" Item 7) but I simply couldn't find any better solution to this problem. I wish I wouldn't need do

RE: IndexReader.close() behavior

2011-05-13 Thread Alexey Lef
beautifully on close(). So, my first choice was to use the incRef()/close() in IndexReader, but IndexReader.close() behavior prevents that. The second thought was creating a delegating wrapper for IndexReader similarly to what I had for IndexSearcher but there are so many methods, and half of them

Re: IndexReader.close() behavior

2011-04-26 Thread Michael McCandless
The code is tricky, but it's intentional. We always set closed to true to guard against double close, ie, it's fine to double-close an IndexReader, ie doing so will not "steal" references from other places that have incRef'd the reader. Can you pass closeSubReaders=false when you create your Mult

IndexReader.close() behavior

2011-04-26 Thread Alexey Lef
This is the code in IndexReader.close(): public final synchronized void close() throws IOException { if (!closed) { decRef(); closed = true; } } What strikes me as odd is that “closed” variable is set to true regardless of whether the index was actually closed using doClo