You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Robert Engels <re...@ix.netcom.com> on 2006/05/04 18:02:58 UTC

Why ThreadLocal?

In reviewing the code for bug 436
(http://issues.apache.org/jira/browse/LUCENE-436)

Why are we using a ThreadLocal for the enumeration at all?

Since terms(), and terms(Term t) return new instances anyway, why not just
have them clone the needed data structures?

Seems like the code could be much simpler and perform just as well.

What am I missing?

Re: Why ThreadLocal?

Posted by Yonik Seeley <ys...@gmail.com>.
On 5/4/06, Robert Engels <re...@ix.netcom.com> wrote:
> In reviewing the code for bug 436
> (http://issues.apache.org/jira/browse/LUCENE-436)
>
> Why are we using a ThreadLocal for the enumeration at all?
>
> Since terms(), and terms(Term t) return new instances anyway, why not just
> have them clone the needed data structures?

Lock contention via use of the same reader from multiple threads, I think.

-Yonik
http://incubator.apache.org/solr Solr, the open-source Lucene search server

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