Make SlowMultiReaderWrapper wrap always so close() is safe
----------------------------------------------------------

                 Key: LUCENE-2772
                 URL: https://issues.apache.org/jira/browse/LUCENE-2772
             Project: Lucene - Java
          Issue Type: Sub-task
            Reporter: Uwe Schindler
            Assignee: Uwe Schindler


The overhead when wrapping an atomic reader using SlowMultiReaderWrapper is 
very low, the work done in the static wrap method is much higher (instantiate 
ArrayList, recusively went through all subreaders), just to check the number of 
readers than simply always wrapping.

MultiFields already is optimized when called by one-segment or atomic readers, 
so there is no overhead at all. So this patch removes the static wrap method 
and you simply wrap like a TokenFilter with ctor: new 
SlowMultiReaderWrapper(reader)

When this is done, there is also no risk to close a SegmentReader (which you 
should not do), when wrap() returns a single SegmentReader. This help in parent 
issue with cleaning up the case in close().

The patch aƶlso removes the now useless mainReader/reader variables and simply 
closes the wrapper.

-- 
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to