org.javasimon.utils
Class SystemDebugCallback

java.lang.Object
  extended by org.javasimon.callback.CallbackSkeleton
      extended by org.javasimon.utils.SystemDebugCallback
All Implemented Interfaces:
Callback

public final class SystemDebugCallback
extends CallbackSkeleton

SystemDebugCallback just prints operations on the standard output, warning is sent to error output.

Author:
Richard "Virgo" Richter

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.javasimon.callback.Callback
Callback.Event
 
Field Summary
static String DEBUG_PREFIX
           
 
Constructor Summary
SystemDebugCallback()
           
 
Method Summary
 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 and stack trace are print out to the error output.
 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.
private  void out(String message)
           
 
Methods inherited from class org.javasimon.callback.CallbackSkeleton
cleanup, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG_PREFIX

public static final String DEBUG_PREFIX
See Also:
Constant Field Values
Constructor Detail

SystemDebugCallback

public SystemDebugCallback()
Method Detail

onSimonReset

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

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

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
Overrides:
onStopwatchStart in class CallbackSkeleton
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
Overrides:
onStopwatchStop in class CallbackSkeleton
Parameters:
split - stopped Split
sample - stopwatch sampled after the stop

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
Overrides:
onStopwatchAdd in class CallbackSkeleton
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
Overrides:
onStopwatchAdd in class CallbackSkeleton
Parameters:
stopwatch - modified Stopwatch
split - added split object
sample - stopwatch sampled after the add

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
Overrides:
onCounterDecrease in class CallbackSkeleton
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
Overrides:
onCounterIncrease in class CallbackSkeleton
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
Overrides:
onCounterSet in class CallbackSkeleton
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
Overrides:
onSimonCreated in class CallbackSkeleton
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
Overrides:
onSimonDestroyed in class CallbackSkeleton
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
Overrides:
onManagerClear in class CallbackSkeleton

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
Overrides:
onManagerMessage in class CallbackSkeleton
Parameters:
message - message text

out

private void out(String message)

onManagerWarning

public void onManagerWarning(String warning,
                             Exception cause)
Warning and stack trace are print out to the error output. Either cause or warning (or both) should be provided otherwise the method does nothing.

Warning event containing warning and/or cause.

Specified by:
onManagerWarning in interface Callback
Overrides:
onManagerWarning in class CallbackSkeleton
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.