org.javasimon.callback.calltree
Class CallTree

java.lang.Object
  extended by org.javasimon.callback.calltree.CallTree
All Implemented Interfaces:
LogMessageSource<Split>

public class CallTree
extends Object
implements LogMessageSource<Split>

Call tree contains the root call tree node and the current call stack.

Since:
3.2
Author:
gquintana

Field Summary
private  LinkedList<CallTreeNode> callStack
          Call stack is the path (made of tree nodes) from root tree node to the current tree node.
private  Long logThreshold
          Log threshold. // TODO in what unit?
private  CallTreeNode rootNode
          Root call tree node.
 
Constructor Summary
CallTree(Long logThreshold)
          Main constructor.
 
Method Summary
 String getLogMessage(Split context)
          Transforms this call tree into a loggable message.
 Long getLogThreshold()
           
 CallTreeNode getRootNode()
           
 void onRootStopwatchStart(CallTreeNode rootNode, Split split)
          When stopwatch is started, and the root tree node is pushed into the call stack, this method is called.
protected  void onRootStopwatchStop(CallTreeNode callTreeNode, Split split)
          When stopwatch is stopped, and root tree node is popped from call stack, this method is called.
 CallTreeNode onStopwatchStart(Split split)
          When stopwatch is started, a new tree node is added to the parent tree node and pushed on the call stack.
 CallTreeNode onStopwatchStop(Split split)
          When stopwatch is stopped, the the split is added to current tree node and this tree node is popped from call stack.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logThreshold

private final Long logThreshold
Log threshold. // TODO in what unit?


callStack

private final LinkedList<CallTreeNode> callStack
Call stack is the path (made of tree nodes) from root tree node to the current tree node.


rootNode

private CallTreeNode rootNode
Root call tree node.

Constructor Detail

CallTree

public CallTree(Long logThreshold)
Main constructor.

Parameters:
logThreshold - Log threshold
Method Detail

onStopwatchStart

public CallTreeNode onStopwatchStart(Split split)
When stopwatch is started, a new tree node is added to the parent tree node and pushed on the call stack. As a result, child tree node becomes the current tree node.

Returns:
Current (child) tree node

onStopwatchStop

public CallTreeNode onStopwatchStop(Split split)
When stopwatch is stopped, the the split is added to current tree node and this tree node is popped from call stack. As a result, parent tree node becomes current tree node.

Returns:
Current (child) tree node

onRootStopwatchStart

public void onRootStopwatchStart(CallTreeNode rootNode,
                                 Split split)
When stopwatch is started, and the root tree node is pushed into the call stack, this method is called. Does nothing but can be overridden for custom needs.

Parameters:
rootNode - Root tree node
split - Root split

onRootStopwatchStop

protected void onRootStopwatchStop(CallTreeNode callTreeNode,
                                   Split split)
When stopwatch is stopped, and root tree node is popped from call stack, this method is called. Does nothing but can be overridden for custom needs, such as logging, storing...


getLogMessage

public String getLogMessage(Split context)
Transforms this call tree into a loggable message.

Specified by:
getLogMessage in interface LogMessageSource<Split>
Parameters:
context - Context
Returns:
Message

getLogThreshold

public Long getLogThreshold()

getRootNode

public CallTreeNode getRootNode()


Copyright © 2013. All Rights Reserved.