Package org.apache.solr.search
Class CpuAllowedLimit
- java.lang.Object
-
- org.apache.solr.search.CpuAllowedLimit
-
- All Implemented Interfaces:
org.apache.lucene.index.QueryTimeout
@NotThreadSafe public class CpuAllowedLimit extends Object implements org.apache.lucene.index.QueryTimeout
Enforces a CPU-time based timeout on a given SolrQueryRequest, as specified by thecpuAllowed
query parameter.Since this class uses
ThreadCpuTimer
it is irrevocably lock-hostile and can never be exposed to multiple threads, even if guarded by synchronization. Normally this is attached to objects ultimately held by a ThreadLocal inSolrRequestInfo
to provide safe usage on the assumption that such objects are not shared to other threads.- See Also:
ThreadCpuTimer
-
-
Constructor Summary
Constructors Constructor Description CpuAllowedLimit(SolrQueryRequest req)
Create an object to represent a CPU time limit for the current request.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
shouldExit()
Return true if usage has exceeded the limit.
-
-
-
Constructor Detail
-
CpuAllowedLimit
public CpuAllowedLimit(SolrQueryRequest req)
Create an object to represent a CPU time limit for the current request. NOTE: this implementation will attempt to obtain an existing thread CPU time monitor, created whenSolrRequestInfo.getThreadCpuTimer()
is initialized.- Parameters:
req
- solr request with acpuAllowed
parameter
-
-