lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "German Kondolf" <german.kond...@gmail.com>
Subject Re: Closing index searchers ...
Date Thu, 29 Nov 2007 15:40:35 GMT
I had the same issue, and end up doing my own reference counting using
"acquire/release" strategy.

I used a single instance per searcher, every "acquire" counts +1 and
every "release" count -1, when a index is switched it receives a
"dispose" signal, then the release checks if there are processing
instances, if all releases were made then the last release closes the
searcher.

The interface looked like this:

public interface Acquirable<R> {

	public R acquire();
	public void release();
	public boolean isAcquired();
	public boolean dispose();

}

In my implementation, I use a threadlocal to attach the searcher's
referenced instance (although it's a single instance per index
switch).

Hope it helps...

German-K

On Nov 29, 2007 12:15 PM, Dragon Fly <dragon-fly999@hotmail.com> wrote:
>
> Hi,
>
> My application needs to close/open the index searcher periodically so that newly added
documents are visible.  Is there a way to determine if there are any pending searches running
against an index searcher or do I have to do my own reference counting? Thank you.
>
> _________________________________________________________________
> You keep typing, we keep giving. Download Messenger and join the i'm Initiative now.
> http://im.live.com/messenger/im/home/?source=TAGLM

---------------------------------------------------------------------
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