Package org.apache.solr.search
Class CallerSpecificQueryLimit
- java.lang.Object
-
- org.apache.solr.search.CallerSpecificQueryLimit
-
- All Implemented Interfaces:
org.apache.lucene.index.QueryTimeout,org.apache.solr.search.QueryLimit
public class CallerSpecificQueryLimit extends Object implements org.apache.solr.search.QueryLimit
Helper class to simulate query timeouts at specific points in various components that callQueryLimits.shouldExit(). These calling points are identified by the calling class' simple name and optionally a method name and the optional maximum count, e.g.MoreLikeThisComponentorClusteringComponent.finishStage,ClusteringComponent.finishStage:100.NOTE: implementation details cause the expression
simpleNameto be disabled when also anysimpleName.anyMethod[:NNN]expression is used for the same class name.NOTE 2: when maximum count is a negative number e.g.
simpleName.someMethod:-1then only the number of calls toQueryLimits.shouldExit()for that expression will be reported but no limit will be enforced.
-
-
Constructor Summary
Constructors Constructor Description CallerSpecificQueryLimit(String... callerExprs)Signal a timeout in places that match the calling classes (and methods).CallerSpecificQueryLimit(Collection<String> callerExprs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectcurrentValue()Map<String,Integer>getCallCounts()Returns a map of tripped caller expressions to their current call counts.Set<String>getTrippedBy()Returns the set of caller expressions that were tripped.booleanshouldExit()
-
-
-
Constructor Detail
-
CallerSpecificQueryLimit
public CallerSpecificQueryLimit(String... callerExprs)
Signal a timeout in places that match the calling classes (and methods).- Parameters:
callerExprs- list of expressions in the format ofsimpleClassName[.methodName][:NNN]. If the list is empty or null then the first call toshouldExit()from any caller will match.
-
CallerSpecificQueryLimit
public CallerSpecificQueryLimit(Collection<String> callerExprs)
-
-
Method Detail
-
getTrippedBy
public Set<String> getTrippedBy()
Returns the set of caller expressions that were tripped.
-
getCallCounts
public Map<String,Integer> getCallCounts()
Returns a map of tripped caller expressions to their current call counts.
-
shouldExit
public boolean shouldExit()
- Specified by:
shouldExitin interfaceorg.apache.lucene.index.QueryTimeout
-
currentValue
public Object currentValue()
- Specified by:
currentValuein interfaceorg.apache.solr.search.QueryLimit
-
-