lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cheng <zhoucheng2...@gmail.com>
Subject Re: NRTManager and AlreadyClosedException
Date Wed, 08 Feb 2012 12:09:05 GMT
You are right. There is a method by which I do searching. At the end of the
method, I release the index searcher (not the searchermanager).

Since this method is called by multiple threads. So I think the index
searcher will be released multiple times.

First, I wonder if releasing searcher is same as releasing the searcher
manager.

Second, as said in Mike's blog, the searcher should be released, which has
seemingly caused the problem. What are my alternatives here to avoid it?

Thanks



On Wed, Feb 8, 2012 at 7:51 PM, Ian Lea <ian.lea@gmail.com> wrote:

> Are you closing the SearcherManager?  Calling release() multiple times?
>
> From the exception message the first sounds most likely.
>
>
> --
> Ian.
>
>
> On Wed, Feb 8, 2012 at 5:20 AM, Cheng <zhoucheng2008@gmail.com> wrote:
> > Hi,
> >
> > I am using NRTManager and NRTManagerReopenThread. Though I don't close
> > either writer or the reopen thread, I receive AlreadyClosedException as
> > follow.
> >
> > My initiating NRTManager and NRTManagerReopenThread are:
> >
> > FSDirectory indexDir = new NIOFSDirectory(new File(
> > indexFolder));
> >
> > IndexWriterConfig iwConfig = new IndexWriterConfig(
> > version, new LimitTokenCountAnalyzer(
> > StandardAnalyzer, maxTokenNum));
> >
> > iw = new IndexWriter(indexDir, iwConfig);
> >
> > nrtm = new NRTManager(iw, null);
> >
> > ropt = new NRTManagerReopenThread(nrtm,
> > targetMaxStaleSec,
> > targetMinStaleSec);
> >
> > ropt.setName("Reopen Thread");
> > ropt.setPriority(Math.min(Thread.currentThread().getPriority() + 2,
> > Thread.MAX_PRIORITY));
> > ropt.setDaemon(true);
> > ropt.start();
> >
> >
> > Where may the searchermanager fall out?
> >
> >
> >
> > org.apache.lucene.store.AlreadyClosedException: this SearcherManager is
> > closed77
> > at
> >
> org.apache.lucene.search.SearcherManager.acquire(SearcherManager.java:235)
> > at
> com.yyt.core.er.lucene.YYTLuceneImpl.codeIndexed(YYTLuceneImpl.java:138)
> > at com.yyt.core.er.main.copy.SingleCodeER.run(SingleCodeER.java:50)
> > at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
> > at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message