org.javasimon.callback
Class CallbackSkeleton

java.lang.Object
  extended by org.javasimon.callback.CallbackSkeleton
All Implemented Interfaces:
Callback
Direct Known Subclasses:
CallTreeCallback, JmxRegisterCallback, LastSplitsCallback, LoggingCallback, LoggingCallback, QuantilesCallback, SLF4JLoggingCallback, SystemDebugCallback, TimelineCallback

public class CallbackSkeleton
extends Object
implements Callback

Implements Callback interface so that it does nothing - intended for extension by simple (non-composite) callbacks. This class is to be subclassed when just a few methods need to be implemented instead of the whole Callback interface.

Author:
Richard "Virgo" Richter

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.javasimon.callback.Callback
Callback.Event
 
Constructor Summary
CallbackSkeleton()
           
 
Method Summary
 void cleanup()
          Lifecycle method called when the callback is removed from the manager.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallbackSkeleton

public CallbackSkeleton()
Method Detail

initialize

public void initialize()
Description copied from interface: Callback
Lifecycle method called when the callback is added to a manager.

Specified by:
initialize in interface Callback

cleanup

public void cleanup()
Description copied from interface: Callback
Lifecycle method called when the callback is removed from the manager. It should implement any necessary cleanup or resources - e.g. release JDBC connection if one was used for Callback functionality.

Specified by:
cleanup in interface Callback

onStopwatchAdd

public void onStopwatchAdd(Stopwatch stopwatch,
                           long ns,
                           StopwatchSample sample)
Description copied from interface: Callback
Stopwatch add time event. StopwatchSample valid for the moment after the add is provided because the callback is executed out of synchronized block.

Specified by:
onStopwatchAdd in interface Callback
Parameters:
stopwatch - modified Stopwatch
ns - added split time in ns
sample - stopwatch sampled after the add

onStopwatchAdd

public void onStopwatchAdd(Stopwatch stopwatch,
                           Split split,
                           StopwatchSample sample)
Description copied from interface: Callback
Stopwatch add split event. StopwatchSample valid for the moment after the add is provided because the callback is executed out of synchronized block.

Specified by:
onStopwatchAdd in interface Callback
Parameters:
stopwatch - modified Stopwatch
split - added split object
sample - stopwatch sampled after the add

onStopwatchStart

public void onStopwatchStart(Split split)
Description copied from interface: Callback
Stopwatch start event. Duration of all callbacks is included into the split time! StopwatchSample valid for the moment after the start is provided because the callback is executed out of synchronized block.

Specified by:
onStopwatchStart in interface Callback
Parameters:
split - started Split

onStopwatchStop

public void onStopwatchStop(Split split,
                            StopwatchSample sample)
Description copied from interface: Callback
Stopwatch stop event. This action is executed after the split time is calculated and does not affect the measuring. StopwatchSample valid for the moment after the stop is provided because the callback is executed out of synchronized block.

Specified by:
onStopwatchStop in interface Callback
Parameters:
split - stopped Split
sample - stopwatch sampled after the stop

onSimonReset

public void onSimonReset(Simon simon)
Description copied from interface: Callback
Simon reset event.

Specified by:
onSimonReset in interface Callback
Parameters:
simon - reset Simon

onCounterDecrease

public void onCounterDecrease(Counter counter,
                              long dec,
                              CounterSample sample)
Description copied from interface: Callback
Counter decrease event. CounterSample valid for the moment after the operation is provided because the callback is executed out of synchronized block.

Specified by:
onCounterDecrease in interface Callback
Parameters:
counter - modified Counter
dec - decrement amount
sample - counter sampled after the operation

onCounterIncrease

public void onCounterIncrease(Counter counter,
                              long inc,
                              CounterSample sample)
Description copied from interface: Callback
Counter increase event. CounterSample valid for the moment after the operation is provided because the callback is executed out of synchronized block.

Specified by:
onCounterIncrease in interface Callback
Parameters:
counter - modified Counter
inc - increment amount
sample - counter sampled after the operation

onCounterSet

public void onCounterSet(Counter counter,
                         long val,
                         CounterSample sample)
Description copied from interface: Callback
Counter set event. CounterSample valid for the moment after the operation is provided because the callback is executed out of synchronized block.

Specified by:
onCounterSet in interface Callback
Parameters:
counter - modified Counter
val - new value
sample - counter sampled after the operation

onSimonCreated

public void onSimonCreated(Simon simon)
Description copied from interface: Callback
Simon created event is called when Simon is successfully created by the Manager.

Specified by:
onSimonCreated in interface Callback
Parameters:
simon - created Simon

onSimonDestroyed

public void onSimonDestroyed(Simon simon)
Description copied from interface: Callback
Simon destroyed event is called when Simon is successfully destroyed by the Manager.

Specified by:
onSimonDestroyed in interface Callback
Parameters:
simon - destroyed Simon

onManagerClear

public void onManagerClear()
Description copied from interface: Callback
Event called when the manager is cleared.

Specified by:
onManagerClear in interface Callback

onManagerMessage

public void onManagerMessage(String message)
Description copied from interface: Callback
Message event is used to propagate arbitrary messages from the manager, or it can be used by the other Callback methods internally.

Specified by:
onManagerMessage in interface Callback
Parameters:
message - message text

onManagerWarning

public void onManagerWarning(String warning,
                             Exception cause)
Description copied from interface: Callback
Warning event containing warning and/or cause.

Specified by:
onManagerWarning in interface Callback
Parameters:
warning - arbitrary warning message - can be null, unless concrete implementation states otherwise
cause - exception causing this warning - can be null, unless concrete implementation states otherwise


Copyright © 2013. All Rights Reserved.