> I guess the fact that Lucene closes it is a legacy we may be stuck with > - but I think it encourages bad practice code. There is plenty of room > for an exception to be thrown before the Reader is sure to be closed in > a finally block. > > Part of why its standard convention to close your own I think, rather > then somewhere in the method you pass it into. Best practice is close it > in a finally block yourself, with the try starting right after you make > it.
That is my opinion, too. Closing the readers should be done by the caller in a finally block and not automatically by the IW. I only wanted to confirm, that the behaviour of 2.9 did not change. Closing readers two times is not a problem. So I would suggest, that all implementors do a close after adding the document to the IW. > Not a big deal though. If it was, we'd know about it by now ;) > > Chris Hostetter wrote: > > : So in 2.9, the Reader is correctly closed, if the TokenStream chain is > > : correctly set up, passing all close() calls to the delegate. > > > > Thanks for digging into that Uwe. > > > > So Daniel: The ball is in your court here: what analyzer / > > tokenizer+tokenfilters is your app using in the cases where you see > > Readers not getting closed by Lucene -- if they involve your own custom > > Tokenizers then that may be where the problem is, but if all the > Analysis > > pieces you are using come out of hte box with Lucene please let us know > so > > we can check them. > > > > > > -Hoss > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org > > For additional commands, e-mail: java-dev-h...@lucene.apache.org > > > > > > > -- > - Mark > > http://www.lucidimagination.com > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-dev-h...@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org For additional commands, e-mail: java-dev-h...@lucene.apache.org