I'd like to propose a patch for IndexReader but before I file a proper bug
and attach the (simple) patch, I want to check here if my approach is the
right one.

I have a server where a bunch of threads are handling search requests. I
have a another process that updates the index used by the search server and
that asks the searcher server to reopen its index reader after the updates
completed.

When I reopen() the index reader, I also close the old one (if the reopen()
yielded a new instance). This causes problems for the other threads that
are currently in the middle of a search request.

I'd like to propose the addition of two methods, acquire() and release() (see below), that increment/decrement the ref count that IndexReader instances currently maintain for related purposes. That ref count prevents the index reader from being actually closed until it reaches zero.

My server's search threads, thus acquiring and releasing the index reader can be sure that the index reader they're currently using is good until they're done with the current request, ie, until they release() it.

Is this the right way to go about this ?

Thanks !

Andi..

     public synchronized void acquire()
         throws AlreadyClosedException
     {
         ensureOpen();
         incRef();
     }

     public synchronized void release()
         throws AlreadyClosedException, IOException
     {
         ensureOpen();
         decRef();
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to