Only to second this explanation. 

I got the same exception in a web application with a single IndexReader, 
accessed by many threads. 

The index gets updated every half hour or so, so I closed the old IndexReader 
and opened a new one every now and then. 

Even though the method for obtaining the IndexReader was synchronized, with 
tens of thousands of queries a day, 
I started getting the AlreadyClosed exception when one thread triggered the 
closure of the IndexReader which another thread was still using.



Piotr

 
On 5 Apr 2011, at 15:46, Ian Lea wrote:

> You don't say exactly how you are dealing with the concurrent access
> (one shared Reader/Searcher? Each user with own Reader/Searcher?
> Something else?) but the underlying problem is that the reader has
> been closed while something else is still using it.  This can easily
> happen in a multi-threaded setup: thread A might close the reader
> while thread B is still using it.
> 
> Options include
> 
> not closing the old reader straight away when open a new one, but
> instead stash it somewhere and close it later when you can be
> confident nothing else will be using it.
> 
> using the SearcherManager class from Lucene In Action 2nd edition, or
> an equivalent.
> 
> catching the AlreadyClosed exception and restarting the search with a
> current reader
> 
> 
> --
> Ian.
> 
> 
> On Tue, Apr 5, 2011 at 12:56 PM, Yogesh Dabhi <yda...@asite.com> wrote:
>> Hi
>> 
>> 
>> 
>> My application is cluster in jobss application servers & lucene
>> directory was shared.
>> 
>> 
>> 
>> Concurrently 5 user access same lucene directory for searching document
>> 
>> That time I got bellow exception
>> 
>> org.apache.lucene.store.AlreadyClosedException: this IndexReader is
>> closed
>> 
>> 
>> 
>> is there a way to handle such error
>> 
>> 
>> 
>> Thanks & Regards
>> 
>> Yogesh
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
> 

Reply via email to