|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javasimon.callback.CallbackSkeleton
org.javasimon.callback.calltree.CallTreeCallback
public class CallTreeCallback
Callback which logs the call tree when the main call is bigger than specified threshold. This callback can give good results only if interceptors/filters have been placed a different level of the application (web/business/data tiers for instance).
Call tree looks like this:
org.javasimon.web.Controller.execute 123ms
org.javasimon.business.FirstService.work 75ms, 75%
org.javasimon.data.FirstDAO.findAll 50 ms, 82%
org.javasimon.data.SecondDAO.findByRelation 20ms, 10%, 3
org.javasimon.business.SecodeService.do 10ms, 5%
CallTree| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.javasimon.callback.Callback |
|---|
Callback.Event |
| Field Summary | |
|---|---|
static String |
ATTR_NAME_LAST
Simon attribute name used to store last significant call tree. |
private LogTemplate<Split> |
callTreeLogTemplate
Log template used for printing call tree. |
private Long |
logThreshold
Duration threshold used to trigger logging and remembering. |
private ThreadLocal<CallTree> |
threadCallTree
Call tree of current thread. |
| Constructor Summary | |
|---|---|
CallTreeCallback()
Default constructor. |
|
CallTreeCallback(LogTemplate<Split> callTreeLogTemplate)
Constructor with log template. |
|
CallTreeCallback(long threshold)
Constructor with logging duration threshold. |
|
| Method Summary | |
|---|---|
private CallTree |
getCallTree()
Returns call tree for current thread. |
static CallTree |
getLastCallTree(Stopwatch stopwatch)
Returns last call tree stored in stopwatch attributes. |
Long |
getLogThreshold()
Returns log threshold when callTreeLogTemplate is a SplitThresholdLogTemplate. |
private CallTree |
initCallTree()
Initializes the call tree for current thread. |
private void |
initLogThreshold(Long threshold)
Configures callTreeLogTemplate with a SplitThresholdLogTemplate. |
void |
onRootStopwatchStop(CallTree callTree,
Split split)
When stopwatch corresponding to root tree node is stopped, this method is called. |
void |
onStopwatchStart(Split split)
Stopwatch start event. |
void |
onStopwatchStop(Split split,
StopwatchSample sample)
Stopwatch stop event. |
private void |
removeCallTree()
Removes call tree for current thread. |
void |
setLogThreshold(Long logThreshold)
Sets log threshold. |
| Methods inherited from class org.javasimon.callback.CallbackSkeleton |
|---|
cleanup, initialize, onCounterDecrease, onCounterIncrease, onCounterSet, onManagerClear, onManagerMessage, onManagerWarning, onSimonCreated, onSimonDestroyed, onSimonReset, onStopwatchAdd, onStopwatchAdd |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final ThreadLocal<CallTree> threadCallTree
private LogTemplate<Split> callTreeLogTemplate
public static final String ATTR_NAME_LAST
private Long logThreshold
| Constructor Detail |
|---|
public CallTreeCallback()
public CallTreeCallback(long threshold)
threshold - Thresholdpublic CallTreeCallback(LogTemplate<Split> callTreeLogTemplate)
callTreeLogTemplate - Log template| Method Detail |
|---|
private void initLogThreshold(Long threshold)
callTreeLogTemplate with a SplitThresholdLogTemplate.
public Long getLogThreshold()
callTreeLogTemplate is a SplitThresholdLogTemplate.
public void setLogThreshold(Long logThreshold)
callTreeLogTemplate with a SplitThresholdLogTemplate.
private CallTree getCallTree()
private CallTree initCallTree()
private void removeCallTree()
public void onStopwatchStart(Split split)
StopwatchSample valid for the moment after the start is provided because the callback
is executed out of synchronized block.
onStopwatchStart in interface CallbackonStopwatchStart in class CallbackSkeletonsplit - started Split
public void onStopwatchStop(Split split,
StopwatchSample sample)
StopwatchSample valid for the moment after the stop is provided
because the callback is executed out of synchronized block.
onStopwatchStop in interface CallbackonStopwatchStop in class CallbackSkeletonsplit - stopped Splitsample - stopwatch sampled after the stop
public void onRootStopwatchStop(CallTree callTree,
Split split)
callTree - call tree to logsplit - stopped splitpublic static CallTree getLastCallTree(Stopwatch stopwatch)
stopwatch - Stopwatch
null if any
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||