[ 
https://issues.apache.org/jira/browse/LUCENE-2108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12785978#action_12785978
 ] 

Michael McCandless commented on LUCENE-2108:
--------------------------------------------

Some feedback on the patch:

  * If you back-port this to 2.9, you can't use any of the
    java.util.concurrent.*

  * I'm not sure you need a separate SearcherHolder class -- can't you
    re-use IndexReader's decRef/incRef?

  * You don't need to do this.XXX in most places (maybe you're coming
    from eg Python? ;) ).

  * Maybe rename "releaseNewSearcher" -> "swapSearcher"?  (Because it
    releases the old one and installs the new one).

  * I think there are some thread safety issues -- eg
    getSearcherHolder isn't sync'd, so, when you incRef
    this.searcherHolder at the start, but then return
    this.searcherHolder at the end, it could be two different
    instances.


> SpellChecker file descriptor leak - no way to close the IndexSearcher used by 
> SpellChecker internally
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-2108
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2108
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: contrib/spellchecker
>    Affects Versions: 3.0
>            Reporter: Eirik Bjorsnos
>            Assignee: Simon Willnauer
>             Fix For: 3.0.1, 3.1
>
>         Attachments: LUCENE-2108-SpellChecker-close.patch, LUCENE-2108.patch, 
> LUCENE-2108.patch
>
>
> I can't find any way to close the IndexSearcher (and IndexReader) that
> is being used by SpellChecker internally.
> I've worked around this issue by keeping a single SpellChecker open
> for each index, but I'd really like to be able to close it and
> reopen it on demand without leaking file descriptors.
> Could we add a close() method to SpellChecker that will close the
> IndexSearcher and null the reference to it? And perhaps add some code
> that reopens the searcher if the reference to it is null? Or would
> that break thread safety of SpellChecker?
> The attached patch adds a close method but leaves it to the user to
> call setSpellIndex to reopen the searcher if desired.

-- 
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

Reply via email to