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.
-
-
Field Summary
Fields Modifier and Type Field Description static ThreadLocal<Long>
timeoutAt
The 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 Long
get()
Get the current value of timeoutAt.static SolrQueryTimeoutImpl
getInstance()
Return singleton instanceboolean
isTimeoutEnabled()
static void
reset()
Cleanup the ThreadLocal timeout value.static void
set(Long timeAllowed)
Method to set the time at which the timeOut should happen.boolean
shouldExit()
Return true if a timeoutAt value is set and the current time has exceeded the set timeOut.String
toString()
-
-
-
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:
isTimeoutEnabled
in 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:
shouldExit
in 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.
-
-