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.
-
-
Field Summary
Fields Modifier and Type Field Description static ThreadLocal<Long>timeoutAtThe ThreadLocal variable to store the time beyond which, the processing should exit.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Longget()Get the current value of timeoutAt.static SolrQueryTimeoutImplgetInstance()Return singleton instancebooleanisTimeoutEnabled()static voidreset()Cleanup the ThreadLocal timeout value.static voidset(Long timeAllowed)Method to set the time at which the timeOut should happen.booleanshouldExit()Return true if a timeoutAt value is set and the current time has exceeded the set timeOut.StringtoString()
-
-
-
Field Detail
-
timeoutAt
public static ThreadLocal<Long> timeoutAt
The ThreadLocal variable to store the time beyond which, the processing should exit.
-
-
Method Detail
-
getInstance
public static SolrQueryTimeoutImpl getInstance()
Return singleton instance
-
get
public static Long get()
Get the current value of timeoutAt.
-
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(Long timeAllowed)
Method to set the time at which the timeOut should happen.- Parameters:
timeAllowed- set the time at which this thread should timeout.
-
reset
public static void reset()
Cleanup the ThreadLocal timeout value.
-
-