[ 
https://issues.apache.org/jira/browse/LUCENE-1026?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546592
 ] 

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();
<code>
write any code here
</code>
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 
accessor.open() twice?

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: https://issues.apache.org/jira/browse/LUCENE-1026
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Index, Search
>            Reporter: Mark Miller
>            Priority: Minor
>         Attachments: DefaultIndexAccessor.java, 
> DefaultMultiIndexAccessor.java, IndexAccessor.java, 
> IndexAccessorFactory.java, MultiIndexAccessor.java, shai-IndexAccessor.zip, 
> SimpleSearchServer.java, StopWatch.java, TestIndexAccessor.java
>
>
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to