|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javasimon.callback.CompositeFilterCallback
public final class CompositeFilterCallback
This callback combines Composite and Filter behavior. Filter can be configured
via addRule(FilterRule.Type, String, String, Callback.Event...)
method and if the rule is satisfied the event is propagated to all
children callbacks added via addCallback(Callback). XML facility for configuration
is provided via ManagerConfiguration.readConfig(java.io.Reader).
Callback.Event.ALL) and per event rules can be added.
Event rules have higher priority and if the filter passes on event rules, global rules are not consulted.
Rules are checked in the order they were added to the filter.
FilterRule| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.javasimon.callback.Callback |
|---|
Callback.Event |
| Field Summary | |
|---|---|
private CompositeCallbackImpl |
callback
|
private Map<Callback.Event,List<FilterRule>> |
rules
|
| Constructor Summary | |
|---|---|
CompositeFilterCallback()
Constructs composite filter callback. |
|
| Method Summary | |
|---|---|
void |
addCallback(Callback callback)
Adds another callback as a child to this callback. |
void |
addRule(FilterRule.Type type,
String condition,
String pattern,
Callback.Event... events)
Adds the rule to the filter. |
List<Callback> |
callbacks()
Returns the list of all child-callbacks. |
void |
cleanup()
Lifecycle method called when the callback is removed from the manager. |
private boolean |
checkRules(Simon simon,
Callback.Event event,
Object... params)
|
void |
initialize()
Lifecycle method called when the callback is added to a manager. |
void |
onCounterDecrease(Counter counter,
long dec,
CounterSample sample)
Counter decrease event. |
void |
onCounterIncrease(Counter counter,
long inc,
CounterSample sample)
Counter increase event. |
void |
onCounterSet(Counter counter,
long val,
CounterSample sample)
Counter set event. |
void |
onManagerClear()
Event called when the manager is cleared. |
void |
onManagerMessage(String message)
Message event is used to propagate arbitrary messages from the manager, or it can be used by the other Callback methods internally. |
void |
onManagerWarning(String warning,
Exception cause)
Warning event containing warning and/or cause. |
void |
onSimonCreated(Simon simon)
Simon created event is called when Simon is successfully created by the Manager. |
void |
onSimonDestroyed(Simon simon)
Simon destroyed event is called when Simon is successfully destroyed by the Manager. |
void |
onSimonReset(Simon simon)
Simon reset event. |
void |
onStopwatchAdd(Stopwatch stopwatch,
long ns,
StopwatchSample sample)
Stopwatch add time event. |
void |
onStopwatchAdd(Stopwatch stopwatch,
Split split,
StopwatchSample sample)
Stopwatch add split event. |
void |
onStopwatchStart(Split split)
Stopwatch start event. |
void |
onStopwatchStop(Split split,
StopwatchSample sample)
Stopwatch stop event. |
private boolean |
patternAndConditionCheck(Simon simon,
FilterRule rule,
Object... params)
|
void |
removeAllCallbacks()
Removes all callbacks from this callback. |
void |
removeCallback(Callback callback)
Removes specified callback from this callback. |
private boolean |
rulesApplyTo(Simon simon,
Callback.Event checkedEvent,
Object... params)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private CompositeCallbackImpl callback
private Map<Callback.Event,List<FilterRule>> rules
| Constructor Detail |
|---|
public CompositeFilterCallback()
| Method Detail |
|---|
public List<Callback> callbacks()
CompositeCallback
callbacks in interface CompositeCallbackpublic void addCallback(Callback callback)
CompositeCallback
addCallback in interface CompositeCallbackcallback - added callbackpublic void removeCallback(Callback callback)
CompositeCallback
removeCallback in interface CompositeCallbackcallback - removed child-callbackpublic void removeAllCallbacks()
CompositeCallback
removeAllCallbacks in interface CompositeCallbackpublic void initialize()
Callback
initialize in interface Callbackpublic void cleanup()
Callback
cleanup in interface Callbackpublic void onSimonReset(Simon simon)
Callback
onSimonReset in interface Callbacksimon - reset Simon
public void onStopwatchAdd(Stopwatch stopwatch,
long ns,
StopwatchSample sample)
CallbackStopwatchSample valid for the moment after the add is provided
because the callback is executed out of synchronized block.
onStopwatchAdd in interface Callbackstopwatch - modified Stopwatchns - added split time in nssample - stopwatch sampled after the add
public void onStopwatchAdd(Stopwatch stopwatch,
Split split,
StopwatchSample sample)
CallbackStopwatchSample valid for the moment after the add is provided
because the callback is executed out of synchronized block.
onStopwatchAdd in interface Callbackstopwatch - modified Stopwatchsplit - added split objectsample - stopwatch sampled after the addpublic void onStopwatchStart(Split split)
CallbackStopwatchSample valid for the moment after the start is provided because the callback
is executed out of synchronized block.
onStopwatchStart in interface Callbacksplit - started Split
public void onStopwatchStop(Split split,
StopwatchSample sample)
CallbackStopwatchSample valid for the moment after the stop is provided
because the callback is executed out of synchronized block.
onStopwatchStop in interface Callbacksplit - stopped Splitsample - stopwatch sampled after the stop
public void onCounterDecrease(Counter counter,
long dec,
CounterSample sample)
CallbackCounterSample valid for the moment after the operation is provided
because the callback is executed out of synchronized block.
onCounterDecrease in interface Callbackcounter - modified Counterdec - decrement amountsample - counter sampled after the operation
public void onCounterIncrease(Counter counter,
long inc,
CounterSample sample)
CallbackCounterSample valid for the moment after the operation is provided
because the callback is executed out of synchronized block.
onCounterIncrease in interface Callbackcounter - modified Counterinc - increment amountsample - counter sampled after the operation
public void onCounterSet(Counter counter,
long val,
CounterSample sample)
CallbackCounterSample valid for the moment after the operation is provided
because the callback is executed out of synchronized block.
onCounterSet in interface Callbackcounter - modified Counterval - new valuesample - counter sampled after the operationpublic void onSimonCreated(Simon simon)
Callback
onSimonCreated in interface Callbacksimon - created Simonpublic void onSimonDestroyed(Simon simon)
Callback
onSimonDestroyed in interface Callbacksimon - destroyed Simonpublic void onManagerClear()
Callback
onManagerClear in interface Callbackpublic void onManagerMessage(String message)
Callback
onManagerMessage in interface Callbackmessage - message text
public void onManagerWarning(String warning,
Exception cause)
Callback
onManagerWarning in interface Callbackwarning - arbitrary warning message - can be null, unless concrete implementation states otherwisecause - exception causing this warning - can be null, unless concrete implementation states otherwise
public void addRule(FilterRule.Type type,
String condition,
String pattern,
Callback.Event... events)
FilterCallback
addRule in interface FilterCallbacktype - rule type (must, suffice, must-not)condition - further conditions of the rulepattern - Simon patternevents - event list (empty applies to all, can be omitted)
private boolean rulesApplyTo(Simon simon,
Callback.Event checkedEvent,
Object... params)
private boolean checkRules(Simon simon,
Callback.Event event,
Object... params)
private boolean patternAndConditionCheck(Simon simon,
FilterRule rule,
Object... params)
throws ScriptException
ScriptException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||