lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sheng <sheng...@gmail.com>
Subject Re: Problem of calling indexWriterConfig.clone()
Date Tue, 12 Aug 2014 02:12:22 GMT
So the indexWriterConfig.clone() failed at this step:
clone.indexerThreadPool = indexerThreadPool
<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.lucene/lucene-core/4.7.0/org/apache/lucene/index/LiveIndexWriterConfig.java#LiveIndexWriterConfig.0indexerThreadPool>
.clone
<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.lucene/lucene-core/4.7.0/org/apache/lucene/index/DocumentsWriterPerThreadPool.java#DocumentsWriterPerThreadPool.clone%28%29>
();

which then failed at this step in the "indexerThreadPool"


if (numThreadStatesActive
<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.lucene/lucene-core/4.7.0/org/apache/lucene/index/DocumentsWriterPerThreadPool.java#DocumentsWriterPerThreadPool.0numThreadStatesActive>
!= 0) {

    throw new IllegalStateException
<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/java/lang/IllegalStateException.java#IllegalStateException>("clone
this object before it is used!");

}


There is a comment right above this:
// We should only be cloned before being used:

Does this mean whenever the indexWriter gets called for
commit/prepareCommit, etc., the corresponding indexWriterConfig object
cannot be called with .clone() at all?


On Mon, Aug 11, 2014 at 9:52 PM, Vitaly Funstein <vfunstein@gmail.com>
wrote:

> Looks like you have to clone it prior to using with any IndexWriter
> instances.
>
>
> On Mon, Aug 11, 2014 at 2:49 PM, Sheng <shengcer@gmail.com> wrote:
>
> > I tried to create a clone of indexwriteconfig with
> > "indexWriterConfig.clone()" for re-creating a new indexwriter, but I
> then I
> > got this very annoying illegalstateexception: "clone this object before
> it
> > is used". Why does this exception happen, and how can I get around it?
> > Thanks!
> >
>

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