|
||||||||||
| 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.lastsplits.LastSplitsCallback
public class LastSplitsCallback
Callback retaining the last N stopwatch splits. Splits can be logged when buffer revolves.
LastSplits| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.javasimon.callback.Callback |
|---|
Callback.Event |
| Field Summary | |
|---|---|
static String |
ATTR_NAME_LAST_SPLITS
Simon attribute name of the LastSplit object stored in Simons. |
private int |
capacity
Number of splits retained in each Simon. |
private LogTemplate<Split> |
enabledStopwatchLogTemplate
SLF4J log template shared by all stopwatches. |
private boolean |
logEnabled
Global flag indicating whether last splits should be logged once in a while. |
| Constructor Summary | |
|---|---|
LastSplitsCallback()
Default constructor with a buffer capacity of 10. |
|
LastSplitsCallback(int capacity)
Constructor with buffer capacity. |
|
| Method Summary | |
|---|---|
protected LogTemplate<Split> |
createLogTemplate(Stopwatch stopwatch)
Create log template for given stopwatch. |
private LastSplits |
getLastSplits(Stopwatch stopwatch)
Get the LastSplits object from Simon attributes. |
boolean |
isLogEnabled()
|
void |
onSimonCreated(Simon simon)
When Stopwatch is created, a Last Splits attributes is added. |
void |
onSimonReset(Simon simon)
When the Stopwatch is reseted, the Last splits attribute as well. |
void |
onStopwatchStop(Split split,
StopwatchSample sample)
When a Splits is stopped, it is added to the stopwatch a Last Splits attribute. |
void |
setLogEnabled(boolean logEnabled)
|
| Methods inherited from class org.javasimon.callback.CallbackSkeleton |
|---|
cleanup, initialize, onCounterDecrease, onCounterIncrease, onCounterSet, onManagerClear, onManagerMessage, onManagerWarning, onSimonDestroyed, onStopwatchAdd, onStopwatchAdd, onStopwatchStart |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ATTR_NAME_LAST_SPLITS
private final int capacity
private boolean logEnabled
private final LogTemplate<Split> enabledStopwatchLogTemplate
| Constructor Detail |
|---|
public LastSplitsCallback()
public LastSplitsCallback(int capacity)
capacity - buffer capacity| Method Detail |
|---|
private LastSplits getLastSplits(Stopwatch stopwatch)
LastSplits object from Simon attributes.
stopwatch - stopwatch
public void onSimonCreated(Simon simon)
onSimonCreated in interface CallbackonSimonCreated in class CallbackSkeletonsimon - created Simon
public void onStopwatchStop(Split split,
StopwatchSample sample)
onStopwatchStop in interface CallbackonStopwatchStop in class CallbackSkeletonsplit - stopped Splitsample - stopwatch sampled after the stoppublic void onSimonReset(Simon simon)
onSimonReset in interface CallbackonSimonReset in class CallbackSkeletonsimon - reset Simonpublic boolean isLogEnabled()
public void setLogEnabled(boolean logEnabled)
protected LogTemplate<Split> createLogTemplate(Stopwatch stopwatch)
isLogEnabled() is set, last splits are logged at each buffer revolution.
stopwatch - Stopwatch
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||