lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: TermInfosReader and clone of SegmentTermEnum
Date Wed, 13 Dec 2006 22:48:38 GMT
Aaaah, I think I get it.
TermIndexReader can be shared by multiple threads.
Each thread will need access to SegmentTermEnum inside the TIR, but since each of them will
search, scan, and seek to a different location, each threads needs its own copy/clone of the
original SegmentTermEnum.

ThreadLocal is then used as a simple cache for the clone of the original SegmentTermEnum,
so a single thread can get to it without repeating scan/seek stuff, and so that each thread
works with its own clone of SegmentTermEnum.

Otis

----- Original Message ----
From: Otis Gospodnetic <otis_gospodnetic@yahoo.com>
To: java-dev@lucene.apache.org
Sent: Wednesday, December 13, 2006 4:53:45 PM
Subject: TermInfosReader and clone of SegmentTermEnum

Hi,

I'm looking at Robert Engels' patches in http://issues.apache.org/jira/browse/LUCENE-436 and
looking at TermInfosReader.
I think I understand why there is ThreadLocal there in the first place - to act as a per-thread
cache for the expensive to compute SegmentTermEnum.... yes?

But why is there is need to clone() the (original) SegmentTermEnum?

Thanks,
Otis




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





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


Mime
View raw message