public class LastSplitsCallback extends CallbackSkeleton
LastSplits
Callback.Event
Modifier and Type | Field and Description |
---|---|
static String |
ATTR_NAME_LAST_SPLITS
Simon attribute name of the LastSplit object stored in Simons.
|
Constructor and Description |
---|
LastSplitsCallback()
Default constructor with a buffer capacity of 10.
|
LastSplitsCallback(int capacity)
Constructor with buffer capacity.
|
Modifier and Type | Method and Description |
---|---|
protected LogTemplate<Split> |
createLogTemplate(Stopwatch stopwatch)
Create log template for given stopwatch.
|
boolean |
isLogEnabled() |
void |
onSimonCreated(Simon simon)
When Stopwatch is created, a Last Splits attributes is added.
|
void |
onStopwatchAdd(Stopwatch stopwatch,
Split split,
StopwatchSample sample)
Stopwatch add split event.
|
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) |
cleanup, initialize, onCounterDecrease, onCounterIncrease, onCounterSet, onManagerClear, onManagerMessage, onManagerWarning, onSimonDestroyed, onStopwatchStart
public static final String ATTR_NAME_LAST_SPLITS
public LastSplitsCallback()
public LastSplitsCallback(int capacity)
capacity
- buffer capacitypublic void onSimonCreated(Simon simon)
onSimonCreated
in interface Callback
onSimonCreated
in class CallbackSkeleton
simon
- created Simonpublic void onStopwatchStop(Split split, StopwatchSample sample)
onStopwatchStop
in interface Callback
onStopwatchStop
in class CallbackSkeleton
split
- stopped Splitsample
- stopwatch sampled after the stoppublic void onStopwatchAdd(Stopwatch stopwatch, Split split, StopwatchSample sample)
Callback
StopwatchSample
valid for the moment after the add is provided
because the callback is executed out of synchronized block.
It is guaranteed that Split.getStopwatch()
will not return null
.onStopwatchAdd
in interface Callback
onStopwatchAdd
in class CallbackSkeleton
stopwatch
- modified Stopwatchsplit
- added split objectsample
- stopwatch sampled after the addpublic 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
- StopwatchCopyright © 2019. All rights reserved.