lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera (JIRA)" <>
Subject [jira] Commented: (LUCENE-1720) TimeLimitedIndexReader and associated utility class
Date Wed, 01 Jul 2009 12:46:47 GMT


Shai Erera commented on LUCENE-1720:

# Can we move to call Thread.currentThread() only once per method? Currently stop() calls
it 3 times, start() 2 and checkTimeoutIsThisThread()
# Can we change TimeoutThread to just wait() on timeLimitedThreads, instead of wait(1000)?
I think it's enough to rely on notify()? Otherwise, if my system is idle, this thread will
wake up every second for nothing.
# Maybe change checkTimeoutIsThisThread to do "if(timedOutThreads.remove(Thread.currentThread())
!= null)" and delete the next line? If a thread has timed out, there's no need to look it
up in the map twice.

Question - TimeoutThread checks firstAnticipatedTimeout vs. the current time and if it has
exceeded, it adds firstAnticipatedThreadToFail to timedoutThreads. I think it will fail in
the following scenario:
* Thread 1 start an activity w/ time 100 (the expected exceeded time).
* Thread 2 start an activity w/ time 150.
* Thread 1 is stuck somewhere.
* TimeoutThread checks the current time against firstAnticipatedTimeout and adds firstAnticipatedThreadToFail
to timedOutThreads.
* Thread 2 checks for timeout, but timedOutThreads does not contain it. Therefore it continues
its execution.

If a thread is stuck, the rest of the threads should not fail on their "timeout exceeded"
checks. How about if when TimeoutThread detects the first timeout has reached it will: (1)
add that thread to the timedOutThreads Set and (2) set "first timeout" to be the next in the
Map/List. I think we'll need an additional LinkedList or something, so that start(), stop(),
check() and will work properly, but that shouldn't be too complicated.

What do you think?

> TimeLimitedIndexReader and associated utility class
> ---------------------------------------------------
>                 Key: LUCENE-1720
>                 URL:
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Index
>            Reporter: Mark Harwood
>            Assignee: Mark Harwood
>            Priority: Minor
>         Attachments:,,,
> An alternative to TimeLimitedCollector that has the following advantages:
> 1) Any reader activity can be time-limited rather than just single searches e.g. the
document retrieve phase.
> 2) Times out faster (i.e. runaway queries such as fuzzies detected quickly before last
"collect" stage of query processing)
> Uses new utility timeout class that is independent of IndexReader.
> Initial contribution includes a performance test class but not had time as yet to work
up a formal Junit test.
> TimeLimitedIndexReader is coded as JDK1.5 but can easily be undone.

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