[ https://issues.apache.org/jira/browse/LUCENE-1707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12724118#action_12724118 ]
Shai Erera commented on LUCENE-1707: ------------------------------------ I tried using closed, but TestIndexReaderReopen fails. It appears that closed is used mainly to not execute close() twice (i.e., after you call it once, calling it again will do nothing) on the same instance. Even after I set closed to false wherever it should be (wherever refCount is increased or set to greater than 0), and set it to true in decRef()'s "if (refCount == 1)" section, the test fails. If I come up w/ isOpen, the test passes. I think it's because IndexWriter.ReadersPool closes a reader, and the test then attempts to close the reader again, then comparing the ref counts. So I'm not sure closed can be used. > Don't use ensureOpen() excessively in IndexReader and IndexWriter > ----------------------------------------------------------------- > > Key: LUCENE-1707 > URL: https://issues.apache.org/jira/browse/LUCENE-1707 > Project: Lucene - Java > Issue Type: Improvement > Components: Index > Reporter: Shai Erera > Fix For: 2.9 > > Attachments: LUCENE-1707.patch > > > A spin off from here: > http://www.nabble.com/Excessive-use-of-ensureOpen()-td24127806.html. > We should stop calling this method when it's not necessary for any internal > Lucene code. Currently, this code seems to hurt properly written apps, > unnecessarily. > Will post a patch soon -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org For additional commands, e-mail: java-dev-h...@lucene.apache.org