org.khelekore.rnio.impl
Class BasicStatisticsHolder

java.lang.Object
  extended by org.khelekore.rnio.impl.BasicStatisticsHolder
All Implemented Interfaces:
StatisticsHolder

public class BasicStatisticsHolder
extends Object
implements StatisticsHolder

A holder of statistics for tasks.

Author:
Robert Olofsson

Constructor Summary
BasicStatisticsHolder()
           
 
Method Summary
 void addPendingTask(TaskIdentifier ti)
          A new task is put in the queue, waiting to be handled.
 void changeTaskStatusToFinished(TaskIdentifier ti, boolean wasOk, long timeSpent)
          A task has been completed.
 void changeTaskStatusToRunning(TaskIdentifier ti)
          A pending task is about to be run.
 Map<String,List<CompletionEntry>> getLatest()
          Get information about the most recent completed tasks
 Map<String,List<CompletionEntry>> getLongest()
          Get information about the longest running task.
 Map<String,List<TaskIdentifier>> getPendingTasks()
          Get information about the currently pending tasks.
 Map<String,List<TaskIdentifier>> getRunningTasks()
          Get information about the currently running tasks.
 Map<String,TotalTimeSpent> getTotalTimeSpent()
          Get the total time spent for each task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicStatisticsHolder

public BasicStatisticsHolder()
Method Detail

addPendingTask

public void addPendingTask(TaskIdentifier ti)
Description copied from interface: StatisticsHolder
A new task is put in the queue, waiting to be handled.

Specified by:
addPendingTask in interface StatisticsHolder
Parameters:
ti - the identifier of the new task.

changeTaskStatusToRunning

public void changeTaskStatusToRunning(TaskIdentifier ti)
Description copied from interface: StatisticsHolder
A pending task is about to be run.

Specified by:
changeTaskStatusToRunning in interface StatisticsHolder
Parameters:
ti - the identifier of the task that will start to run.

changeTaskStatusToFinished

public void changeTaskStatusToFinished(TaskIdentifier ti,
                                       boolean wasOk,
                                       long timeSpent)
Description copied from interface: StatisticsHolder
A task has been completed.

Specified by:
changeTaskStatusToFinished in interface StatisticsHolder
Parameters:
ti - the identifier of the task that has completed.
wasOk - true if the task completed without errors, false otherwise.
timeSpent - wall clock time spent on the task.

getPendingTasks

public Map<String,List<TaskIdentifier>> getPendingTasks()
Description copied from interface: StatisticsHolder
Get information about the currently pending tasks.

Specified by:
getPendingTasks in interface StatisticsHolder
Returns:
a mapping from group ids to the task identifiers

getRunningTasks

public Map<String,List<TaskIdentifier>> getRunningTasks()
Description copied from interface: StatisticsHolder
Get information about the currently running tasks.

Specified by:
getRunningTasks in interface StatisticsHolder
Returns:
a mapping from group ids to the task identifiers

getLatest

public Map<String,List<CompletionEntry>> getLatest()
Description copied from interface: StatisticsHolder
Get information about the most recent completed tasks

Specified by:
getLatest in interface StatisticsHolder
Returns:
a mapping from group ids to the task identifiers

getLongest

public Map<String,List<CompletionEntry>> getLongest()
Description copied from interface: StatisticsHolder
Get information about the longest running task.

Specified by:
getLongest in interface StatisticsHolder
Returns:
a mapping from group ids to the task identifiers

getTotalTimeSpent

public Map<String,TotalTimeSpent> getTotalTimeSpent()
Description copied from interface: StatisticsHolder
Get the total time spent for each task.

Specified by:
getTotalTimeSpent in interface StatisticsHolder
Returns:
a mapping from group ids to the task identifiers