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 ofQueryTimeoutthat 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 SolrQueryTimeoutImplgetInstance()Return singleton instancestatic LonggetTimeoutAtNs()The time (nanoseconds) at which the request should be considered timed out.booleanisTimeoutEnabled()static voidreset()Cleanup the ThreadLocal timeout value.static voidset(long timeAllowed)Sets the time allowed (milliseconds), assuming we start a timer immediately.static voidset(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.booleanshouldExit()Return true if a timeoutAt value is set and the current time has exceeded the set timeOut.StringtoString()
-
-
-
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()
- Specified by:
isTimeoutEnabledin interfaceorg.apache.lucene.index.QueryTimeout
-
shouldExit
public boolean shouldExit()
Return true if a timeoutAt value is set and the current time has exceeded the set timeOut.- Specified by:
shouldExitin 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.
-
-