Class CallerMatcher
MoreLikeThisComponent or ClusteringComponent.finishStage
, ClusteringComponent.finishStage:100. A single wildcard name *
may be used to mean "any class", which may be useful to e.g. collect all callers using an
expression *:-1.
Within your caller you should invoke checkCaller() to count any matching frames in
the current stack, and check if any of the count limits has been reached. Each invocation will
increase the call count of the matching expression(s). For one invocation multiple matching
expression counts can be affected because all current stack frames are examined against the
matching expressions.
NOTE: implementation details cause the expression simpleName[:NNN] to be disabled
when also any simpleName.anyMethod[:NNN] expression is used for the same class name.
NOTE 2: when maximum count is a negative number e.g. simpleName[.someMethod]:-1
then only the number of calls to checkCaller() for the matching expressions will be
reported but checkCaller() will never return this expression.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCallerMatcher(Collection<String> callerExprs, Collection<String> excludeExprs) Create an instance that reacts to the specified caller expressions. -
Method Summary
Modifier and TypeMethodDescriptionReturns the matching caller expression when its count limit was reached, or empty if no caller or no count limit was reached.Returns a map of matched caller expressions to their current call counts.Returns the set of caller expressions that were tripped (reached their count limit).
-
Field Details
-
WILDCARD
- See Also:
-
-
Constructor Details
-
CallerMatcher
Create an instance that reacts to the specified caller expressions.- Parameters:
callerExprs- list of expressions in the format of( simpleClassName[.methodName] | * )[:NNN]. If the list is empty or null then the first call tocheckCaller()()} from any caller will match.
-
-
Method Details
-
getTrippedBy
Returns the set of caller expressions that were tripped (reached their count limit). This method can be called aftercheckCaller()returns a matching expression to obtain all expressions that exceeded their count limits. -
getCallCounts
Returns a map of matched caller expressions to their current call counts. -
checkCaller
Returns the matching caller expression when its count limit was reached, or empty if no caller or no count limit was reached. Each invocation increases the call count of the matching caller, if any. It's up to the caller to decide whether to continue processing after this count limit is reached. The matching expression returned by this call will be also present ingetTrippedBy().
-