lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera (JIRA)" <>
Subject [jira] Commented: (LUCENE-1026) Provide a simple way to concurrently access a Lucene index from multiple threads
Date Thu, 29 Nov 2007 08:01:42 GMT


Shai Erera commented on LUCENE-1026:

Hey Mark, few more questions:
1. Why is StopWatch needed? it seems like the only thing it does is count the time of execution
of the code. That can be easily achieved by writing this:
long time = System.currentTimeMillis();
write any code here
time = System.currentTimeMillis() - time;
System.out.println('time: " + time + " ms");

Am I missing something?

2. In DefaultIndexAccessor there's this code:
  public int writersOut() {
    int writers;

    synchronized (this) {
      writers = this.writerUseCount;

    return writers;

I think it should be replaced with:
  public int writersOut() {
    return writerUseCount;
No need to synchronize on *this* since you're only returning the value, not performing any
modifications to it. The same goes for writingReadersOut, activeSearchers, isOpen.
What do you think?

3. open() -- is there a real need to throw an exception if someone called the

I'll attach the modified test and DefaultIndexAccessor files for your review. I'd apprecite
if you can answer the questions.

> Provide a simple way to concurrently access a Lucene index from multiple threads
> --------------------------------------------------------------------------------
>                 Key: LUCENE-1026
>                 URL:
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Index, Search
>            Reporter: Mark Miller
>            Priority: Minor
>         Attachments:,,,,,,,,
> For building interactive indexes accessed through a network/internet (multiple threads).
> This builds upon the LuceneIndexAccessor patch. That patch was not very newbie friendly
and did not properly handle MultiSearchers (or at the least made it easy to get into trouble).
> This patch simplifies things and provides out of the box support for sharing the IndexAccessors
across threads. There is also a simple test class and example SearchServer to get you started.
> Future revisions will be zipped.
> Works pretty solid as is, but could use the ability to warm new Searchers.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message