Class TimeAllowedLimit

  • All Implemented Interfaces:
    org.apache.lucene.index.QueryTimeout

    public class TimeAllowedLimit
    extends Object
    implements org.apache.lucene.index.QueryTimeout
    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 Detail

      • TimeAllowedLimit

        public TimeAllowedLimit​(SolrQueryRequest req)
        Create an object to represent a time limit for the current request.
        Parameters:
        req - A solr request that has a value for timeAllowed
        Throws:
        IllegalArgumentException - if the request does not contain timeAllowed parameter. This should be validated with hasTimeLimit(SolrQueryRequest) prior to constructing this object
    • Method Detail

      • shouldExit

        public boolean shouldExit()
        Return true if a max limit value is set and the current usage has exceeded the limit.
        Specified by:
        shouldExit in interface org.apache.lucene.index.QueryTimeout