net.sourceforge.basher
Interface Collector

All Known Implementing Classes:
AbstractCollector, AbstractFileCollector, CSVFileCollector, StdOutCollector, XMLFileCollector

public interface Collector

Defines the operations required for collecting statistical information about the running tasks.

Version:
1.0
Author:
Johan Lindquist

Method Summary
 void fail(TaskExecutionContext taskExecutionContext, long elapsedTime, long elapsedTimeNanos, Throwable throwable)
          Reports a task's failure to run together with the time time elapsed for the failure.
 List<Average> getAverages()
          Retrieves the list of averages calculated over time.
 long getFailures()
          Retrieves the total number of failures recorded.
 long getNotRun()
          Retrieves the total number of tasks that didn't wish to run
 long getSuccesses()
          Retrieves the total number of successes recorded.
 long getTotal()
          Retrieves the total number of tasks that were recorded (essentially successes+failures).
 boolean isCollecting()
          Checks if the collector is currently collecting statistics.
 Average markAverage()
          Informs the collector that a collection period has finished.
 void notRun(TaskExecutionContext taskExecutionContext, long elapsedTime, long elapsedTimeNanos)
          Reports a task's wish to not run altogether with the time time elapsed for it to determine this.
 void startCollecting()
          Signals to the collector that statistics collection should start.
 void stopCollecting()
          Signals to the collector that collection should stop.
 void success(TaskExecutionContext taskExecutionContext, long elapsedTime, long elapsedTimeNanos)
          Reports a task's successful invocation together with the time elapsed for the task to run.
 

Method Detail

startCollecting

void startCollecting()
Signals to the collector that statistics collection should start.


stopCollecting

void stopCollecting()
Signals to the collector that collection should stop.


isCollecting

boolean isCollecting()
Checks if the collector is currently collecting statistics.

Returns:
True if the collector is collecting data, otherwise false.

success

void success(TaskExecutionContext taskExecutionContext,
             long elapsedTime,
             long elapsedTimeNanos)
Reports a task's successful invocation together with the time elapsed for the task to run.

Parameters:
taskExecutionContext - The task execution context wrapping the Task that was invoked
elapsedTime - The time it took for the task to run
elapsedTimeNanos -

fail

void fail(TaskExecutionContext taskExecutionContext,
          long elapsedTime,
          long elapsedTimeNanos,
          Throwable throwable)
Reports a task's failure to run together with the time time elapsed for the failure. The (possible) cause of the failure is also provided.

Parameters:
taskExecutionContext - The task execution context wrapping the Task that failed
elapsedTime - The time it took for the task to run and fail.
elapsedTimeNanos -
throwable - The cause of the failure. This may be null if the cause of the failure is not an exception.

getFailures

long getFailures()
Retrieves the total number of failures recorded.

Returns:
The number of failures recorded.

getSuccesses

long getSuccesses()
Retrieves the total number of successes recorded.

Returns:
The number of successes recorded.

getTotal

long getTotal()
Retrieves the total number of tasks that were recorded (essentially successes+failures).

Returns:
The total number of tasks recorded.

markAverage

Average markAverage()
Informs the collector that a collection period has finished.


getAverages

List<Average> getAverages()
Retrieves the list of averages calculated over time.

Returns:
A list of Average instances.

notRun

void notRun(TaskExecutionContext taskExecutionContext,
            long elapsedTime,
            long elapsedTimeNanos)
Reports a task's wish to not run altogether with the time time elapsed for it to determine this.

Parameters:
taskExecutionContext - The task execution context wrapping the Task that didn't wish to run
elapsedTime - The time it took for the task to run and determine it didn't want to run
elapsedTimeNanos -

getNotRun

long getNotRun()
Retrieves the total number of tasks that didn't wish to run

Returns:
The total number of tasks not wishing to run.


Copyright © 2006-2010 Basher Team. All Rights Reserved.