lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Cherouvim ...@eworx.gr>
Subject Re: SpellChecker AlreadyClosedException issue
Date Fri, 10 Apr 2009 08:54:04 GMT
dir is a local variable inside a method, so it's not getting reused.
Should I synchronise the whole method? I think that would slow things 
down in a concurrent environment.

Thanks for your response.


Chris Hostetter wrote:
> : My code looks like this:
> : 
> : Directory dir = null;
> : try {
> :    dir = FSDirectory.getDirectory("/path/to/dictionary");
> :    SpellChecker spell = new SpellChecker(dir); // exception thrown here
> :    // ...
> :    dir.close();
>
> : This code works, but in a highly concurrent situation AlreadyClosedException
> : is being thrown when I try to instantiate the SpellChecker:
> : org.apache.lucene.store.AlreadyClosedException: this Directory is closed
>
> if an error only happens under high concurrent load, it suggests that 
> perhaps you have multiple threads attempting to close the directory.  you 
> haven't clarified whether "dir" is a local variable inside a method, or an 
> instnace variable in an object which is getting reused by multiple 
> threads -- so it's hard to guess.
>
> : I use lucene-core-2.4.1.jar and lucene-spellchecker-2.4.1.jar and I can
> : reproduce the error in both windows and linux.
>
> if you have a fully exeuctable test case (instead of just an incomplete 
> partial snippet) that you can share, people may be able to spot the 
> problem, or at the very least run the test themselves to reproduce.
>
>
> -Hoss
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
>   

-- 
Ioannis Cherouvim
Software Engineer
mail: jc@eworx.gr
web: www.eworx.gr


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message