Package org.apache.solr.search
Class SolrQueryTimeoutImpl
- java.lang.Object
-
- org.apache.solr.search.SolrQueryTimeoutImpl
-
- All Implemented Interfaces:
org.apache.lucene.index.QueryTimeout
public class SolrQueryTimeoutImpl extends Object implements org.apache.lucene.index.QueryTimeout
Implementation ofQueryTimeout
that is used by Solr. It uses a ThreadLocal variable to track the timeoutAt value for each request thread.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SolrQueryTimeoutImpl
getInstance()
Return singleton instancestatic Long
getTimeoutAtNs()
The time (nanoseconds) at which the request should be considered timed out.boolean
isTimeoutEnabled()
static void
reset()
Cleanup the ThreadLocal timeout value.static void
set(long timeAllowed)
Sets the time allowed (milliseconds), assuming we start a timer immediately.static void
set(SolrQueryRequest req)
Sets or clears the time allowed based on how much time remains from the start of the request plus the configuredCommonParams.TIME_ALLOWED
.boolean
shouldExit()
Return true if a timeoutAt value is set and the current time has exceeded the set timeOut.String
toString()
-
-
-
Method Detail
-
getInstance
public static SolrQueryTimeoutImpl getInstance()
Return singleton instance
-
getTimeoutAtNs
public static Long getTimeoutAtNs()
The time (nanoseconds) at which the request should be considered timed out.
-
isTimeoutEnabled
public boolean isTimeoutEnabled()
-
shouldExit
public boolean shouldExit()
Return true if a timeoutAt value is set and the current time has exceeded the set timeOut.- Specified by:
shouldExit
in interfaceorg.apache.lucene.index.QueryTimeout
-
set
public static void set(SolrQueryRequest req)
Sets or clears the time allowed based on how much time remains from the start of the request plus the configuredCommonParams.TIME_ALLOWED
.
-
set
public static void set(long timeAllowed)
Sets the time allowed (milliseconds), assuming we start a timer immediately. You should probably invokeset(SolrQueryRequest)
instead.
-
reset
public static void reset()
Cleanup the ThreadLocal timeout value.
-
-