public class QueryTimeoutImpl extends Object implements QueryTimeout
QueryTimeout
that can be used by
the ExitableDirectoryReader
class to time out and exit out
when a query takes a long time to rewrite.Constructor and Description |
---|
QueryTimeoutImpl(long timeAllowed)
Sets the time at which to time out by adding the given timeAllowed to the current time.
|
Modifier and Type | Method and Description |
---|---|
Long |
getTimeoutAt()
Returns time at which to time out, in nanoseconds relative to the (JVM-specific)
epoch for
System.nanoTime() , to compare with the value returned by
nanoTime() . |
void |
reset()
Reset the timeout value.
|
boolean |
shouldExit()
Return true if
reset() has not been called
and the elapsed time has exceeded the time allowed. |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isTimeoutEnabled
public QueryTimeoutImpl(long timeAllowed)
timeAllowed
- Number of milliseconds after which to time out. Use Long.MAX_VALUE
to effectively never time out.public Long getTimeoutAt()
System.nanoTime()
, to compare with the value returned by
nanoTime()
.public boolean shouldExit()
reset()
has not been called
and the elapsed time has exceeded the time allowed.shouldExit
in interface QueryTimeout
public void reset()
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.