Package org.apache.solr.search
Class TimeAllowedLimit
java.lang.Object
org.apache.solr.search.TimeAllowedLimit
- All Implemented Interfaces:
org.apache.lucene.index.QueryTimeout,QueryLimit
Enforces a wall clock based timeout on a given SolrQueryRequest. This class holds the logic for
the
timeAllowed query parameter. Note that timeAllowed will be ignored for
local processing of sub-queries in cases where the parent query already
has timeAllowed set. Essentially only one timeAllowed can be specified for any thread
executing a query. This is to ensure that subqueries don't escape from the intended limit-
Constructor Summary
ConstructorsConstructorDescriptionCreate an object to represent a time limit for the current request. -
Method Summary
Modifier and TypeMethodDescriptionA value representing the portion of the specified limit that has been consumed.booleanReturn true if a max limit value is set and the current usage has exceeded the limit.
-
Constructor Details
-
TimeAllowedLimit
Create an object to represent a time limit for the current request.- Parameters:
req- A solr request that has a value fortimeAllowed- Throws:
IllegalArgumentException- if the request does not contain timeAllowed parameter. This should be validated withhasTimeLimit(SolrQueryRequest)prior to constructing this object
-
-
Method Details
-
shouldExit
public boolean shouldExit()Return true if a max limit value is set and the current usage has exceeded the limit.- Specified by:
shouldExitin interfaceorg.apache.lucene.index.QueryTimeout
-
currentValue
Description copied from interface:QueryLimitA value representing the portion of the specified limit that has been consumed. Reading this value should never affect the outcome (other than the time it takes to do it).- Specified by:
currentValuein interfaceQueryLimit- Returns:
- an expression of the amount of the limit used so far, numeric if possible, if non-numeric it should have toString() suitable for logging or similar expression to the user.
-