etm.core.monitor
Class EtmMonitorSupport

java.lang.Object
  extended by etm.core.monitor.EtmMonitorSupport
All Implemented Interfaces:
EtmMonitor, AggregationStateListener, EtmMonitorListener
Direct Known Subclasses:
FlatMonitor, NestedMonitor, NullMonitor

public abstract class EtmMonitorSupport
extends java.lang.Object
implements EtmMonitor, AggregationStateListener

Abstract base class for the execution time measurement monitors. An EtmMonitor mandates the following life cycle for measurement points.

  1. Newly created MeasurementPoint instances register themself automatically before the actual measurement process using visitPreMeasurement(MeasurementPoint).
  2. Within visitPreMeasurement(etm.core.monitor.MeasurementPoint) the EtmMonitor sets the start time of the measurement.
  3. The calling business code executes.
  4. After business code execution the Measurement Point calls visitPostCollect(MeasurementPoint). This call is triggered by MeasurementPoint.collect().
  5. Within visitPostCollect(etm.core.monitor.MeasurementPoint) the EtmMonitor sets the end time of the measurement and stores this transaction for further aggregation.

Version:
$Revision: 208 $
Author:
void.fm

Field Summary
protected  Aggregator aggregator
           
protected  java.lang.String description
           
protected  java.util.List plugins
           
protected  ExecutionTimer timer
           
 
Constructor Summary
protected EtmMonitorSupport(java.lang.String aDescription, ExecutionTimer aTimer, Aggregator aAggregator)
          Creates a EtmMonitorSupport instance.
 
Method Summary
 void addPlugin(EtmPlugin aEtmPlugin)
          Adds a new plugin which is part of the EtmMonitor lifecycle.
 void aggregate()
          Aggregates the current measurement details.
 EtmPoint createPoint(java.lang.String symbolicName)
          Creates a new EtmPoint with the given name.
 void disableCollection()
          Disables result collection.
protected abstract  void doVisitPostCollect(MeasurementPoint aPoint)
          

Callback method for derived classes.

protected abstract  void doVisitPreMeasurement(MeasurementPoint aMeasurementPoint)
          

Callback method for derived classes.

 void enableCollection()
          Enables result collection.
protected  Aggregator getDefaultAggregator()
           
 EtmMonitorMetaData getMetaData()
          Returns metadata for the monitor.
 boolean isCollecting()
          Returns whether the given monitor instance is collecting results right now.
 boolean isStarted()
          Returns wether the monitor is started or not.
 void onStateLoaded(AggregationStateLoadedEvent event)
           
 void render(MeasurementRenderer renderer)
          Renders the current measurement results.
 void reset()
          Resets all available measurements.
 void reset(java.lang.String measurementPoint)
          Resets a specific measurement.
 void setPlugins(java.util.List newPlugins)
          Adds a list of plugins.
protected  void shutdownPlugins()
           
 void start()
          Starts the EtmMonitor.
protected  void startPlugins()
           
 void stop()
          Stops the EtmMonitor.
 void visitPostCollect(MeasurementPoint measurementPoint)
           
 void visitPreMeasurement(MeasurementPoint measurementPoint)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

description

protected final java.lang.String description

timer

protected final ExecutionTimer timer

aggregator

protected final Aggregator aggregator

plugins

protected java.util.List plugins
Constructor Detail

EtmMonitorSupport

protected EtmMonitorSupport(java.lang.String aDescription,
                            ExecutionTimer aTimer,
                            Aggregator aAggregator)
Creates a EtmMonitorSupport instance.

Parameters:
aDescription - The description for this monitor.
aTimer - The timer to use.
aAggregator - The aggregator to use.
Method Detail

createPoint

public EtmPoint createPoint(java.lang.String symbolicName)
Description copied from interface: EtmMonitor
Creates a new EtmPoint with the given name. The name may be null until EtmMonitor#collect is called.

Specified by:
createPoint in interface EtmMonitor
Parameters:
symbolicName - The symbolic name or null. Ensure to call EtmPoint.alterName(String) before collection if symbolic name was null.
Returns:
A new EtmMpoint

visitPreMeasurement

public final void visitPreMeasurement(MeasurementPoint measurementPoint)

visitPostCollect

public final void visitPostCollect(MeasurementPoint measurementPoint)

aggregate

public final void aggregate()
Description copied from interface: EtmMonitor
Aggregates the current measurement details.

Specified by:
aggregate in interface EtmMonitor

render

public void render(MeasurementRenderer renderer)
Description copied from interface: EtmMonitor
Renders the current measurement results.

Specified by:
render in interface EtmMonitor
Parameters:
renderer - A measurement renderer.

reset

public void reset()
Description copied from interface: EtmMonitor
Resets all available measurements.

Specified by:
reset in interface EtmMonitor

reset

public void reset(java.lang.String measurementPoint)
Description copied from interface: EtmMonitor
Resets a specific measurement.

Specified by:
reset in interface EtmMonitor
Parameters:
measurementPoint - The symbolic name of the measurement to reset.

getMetaData

public final EtmMonitorMetaData getMetaData()
Description copied from interface: EtmMonitor
Returns metadata for the monitor.

Specified by:
getMetaData in interface EtmMonitor
Returns:
The monitor meta data.

start

public void start()
Description copied from interface: EtmMonitor
Starts the EtmMonitor.

Specified by:
start in interface EtmMonitor

stop

public void stop()
Description copied from interface: EtmMonitor
Stops the EtmMonitor.

Specified by:
stop in interface EtmMonitor

isStarted

public boolean isStarted()
Description copied from interface: EtmMonitor
Returns wether the monitor is started or not.

Specified by:
isStarted in interface EtmMonitor
Returns:
True if started, otherwhise false.

enableCollection

public void enableCollection()
Description copied from interface: EtmMonitor
Enables result collection.

Specified by:
enableCollection in interface EtmMonitor

disableCollection

public void disableCollection()
Description copied from interface: EtmMonitor
Disables result collection.

Specified by:
disableCollection in interface EtmMonitor

isCollecting

public boolean isCollecting()
Description copied from interface: EtmMonitor
Returns whether the given monitor instance is collecting results right now.

Specified by:
isCollecting in interface EtmMonitor
Returns:
True for enabled collection, otherwhise false.

addPlugin

public void addPlugin(EtmPlugin aEtmPlugin)
Description copied from interface: EtmMonitor
Adds a new plugin which is part of the EtmMonitor lifecycle.

Specified by:
addPlugin in interface EtmMonitor
Parameters:
aEtmPlugin - The new EtmPlugin.

setPlugins

public void setPlugins(java.util.List newPlugins)
Description copied from interface: EtmMonitor
Adds a list of plugins.

Specified by:
setPlugins in interface EtmMonitor
Parameters:
newPlugins - A list of EtmPlugin.

onStateLoaded

public void onStateLoaded(AggregationStateLoadedEvent event)
Specified by:
onStateLoaded in interface AggregationStateListener

doVisitPreMeasurement

protected abstract void doVisitPreMeasurement(MeasurementPoint aMeasurementPoint)

Callback method for derived classes.

This method is called immediately after the measurement point was created. Note that neither MeasurementPoint.getTicks() nor MeasurementPoint.getStartTime() are set at that point.

Parameters:
aMeasurementPoint - The measurement point just created.

doVisitPostCollect

protected abstract void doVisitPostCollect(MeasurementPoint aPoint)

Callback method for derived classes.

This method is called immediately after the measurement point was collected and marked as closed. At that point the all required information are valid for that measurement point.

Parameters:
aPoint - The point to collect.

getDefaultAggregator

protected Aggregator getDefaultAggregator()

shutdownPlugins

protected void shutdownPlugins()

startPlugins

protected void startPlugins()


Copyright © 2004,2005, 2006, 2007 void.fm. All Rights Reserved.