Package org.apache.lucene.index
Class QueryTimeoutImpl
- java.lang.Object
-
- org.apache.lucene.index.QueryTimeoutImpl
-
- All Implemented Interfaces:
QueryTimeout
public class QueryTimeoutImpl extends Object implements QueryTimeout
An implementation ofQueryTimeout
that can be used by theExitableDirectoryReader
class to time out and exit out when a query takes a long time to rewrite.
-
-
Constructor Summary
Constructors Constructor Description QueryTimeoutImpl(long timeAllowed)
Sets the time at which to time out by adding the given timeAllowed to the current time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Long
getTimeoutAt()
Returns time at which to time out, in nanoseconds relative to the (JVM-specific) epoch forSystem.nanoTime()
, to compare with the value returned bynanoTime()
.void
reset()
Reset the timeout value.boolean
shouldExit()
Return true ifreset()
has not been called and the elapsed time has exceeded the time allowed.String
toString()
-
-
-
Method Detail
-
getTimeoutAt
public Long getTimeoutAt()
Returns time at which to time out, in nanoseconds relative to the (JVM-specific) epoch forSystem.nanoTime()
, to compare with the value returned bynanoTime()
.
-
shouldExit
public boolean shouldExit()
Return true ifreset()
has not been called and the elapsed time has exceeded the time allowed.- Specified by:
shouldExit
in interfaceQueryTimeout
- Returns:
- true if the query should stop, false otherwise
-
reset
public void reset()
Reset the timeout value.
-
-