|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.basher.impl.AbstractCollector net.sourceforge.basher.impl.AbstractFileCollector
public abstract class AbstractFileCollector
Nested Class Summary | |
---|---|
static class |
AbstractFileCollector.Classifier
|
class |
AbstractFileCollector.FileEntry
|
static class |
AbstractFileCollector.Type
|
Field Summary | |
---|---|
protected String |
_collectionDirectory
|
protected Map<String,net.sourceforge.basher.impl.AbstractFileCollector.OpenFile> |
_openFiles
|
protected File |
_parent
|
Fields inherited from class net.sourceforge.basher.impl.AbstractCollector |
---|
_log, _timeSource |
Constructor Summary | |
---|---|
AbstractFileCollector()
|
Method Summary | |
---|---|
protected void |
closeOpenResources()
|
protected void |
dumpAverage(Average average)
Writes the specified Average to the averag file. |
void |
fail(TaskExecutionContext taskExecutionContext,
long elapsedTime,
long elapsedTimeNanos,
Throwable throwable)
Writes the result of a failed task to the failure file. |
protected abstract String |
formatAverage(Average average)
|
protected abstract String |
formatExecution(String taskName,
long elapsedTime,
long elapsedTimeNanos)
|
protected BufferedWriter |
getWriter(String fileKey,
AbstractFileCollector.Classifier classifier,
Object... headerParams)
Retrieves (and possibly creates) a new writer on to which to write data |
protected void |
initializeCollector(BasherContext basherContext)
|
void |
initializeService()
Initializes the service. |
Average |
markAverage()
Ensures the average over the last time slice is written to disk. |
void |
notRun(TaskExecutionContext taskExecutionContext,
long elapsedTime,
long elapsedTimeNanos)
Writes the result of a not tun task execution to the notrun file. |
void |
setAverageFilenamePrefix(String averageFilenamePrefix)
|
void |
setAverageFooter(String averageFooter)
|
void |
setAverageHeader(String averageHeader)
|
void |
setExecutionFooter(String executionFooter)
|
void |
setExecutionHeader(String executionHeader)
|
void |
setExtension(String extension)
|
void |
setNumThreads(int numThreads)
|
void |
setQueueCapacity(int queueCapacity)
|
void |
setTimeOut(long timeOut)
|
void |
success(TaskExecutionContext taskExecutionContext,
long elapsedTime,
long elapsedTimeNanos)
Writes the result of a successful task execution to the success file. |
protected void |
writeToFile(AbstractFileCollector.Type type,
String taskName,
long elapsedTime,
long elapsedTimeNanos)
Writes the time the specified task took to execute. |
Methods inherited from class net.sourceforge.basher.impl.AbstractCollector |
---|
basherEvent, getAverages, getFailures, getNotRun, getSuccesses, getTotal, isCollecting, registryDidShutdown, setLog, setTimeSource, startCollecting, stopCollecting |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Map<String,net.sourceforge.basher.impl.AbstractFileCollector.OpenFile> _openFiles
protected File _parent
protected String _collectionDirectory
Constructor Detail |
---|
public AbstractFileCollector()
Method Detail |
---|
public void setNumThreads(int numThreads)
public void setTimeOut(long timeOut)
public void setQueueCapacity(int queueCapacity)
public void setAverageFooter(String averageFooter)
public void setExecutionFooter(String executionFooter)
public void setAverageHeader(String averageHeader)
public void setExecutionHeader(String executionHeader)
public void setExtension(String extension)
public void setAverageFilenamePrefix(String averageFilenamePrefix)
public void initializeService() throws Exception
Exception
- If the script directory does not exist or can not be written topublic void success(TaskExecutionContext taskExecutionContext, long elapsedTime, long elapsedTimeNanos)
success
in interface Collector
success
in class AbstractCollector
taskExecutionContext
- The task execution context wrapping the executed task.elapsedTime
- Time of executionelapsedTimeNanos
- public void fail(TaskExecutionContext taskExecutionContext, long elapsedTime, long elapsedTimeNanos, Throwable throwable)
fail
in interface Collector
fail
in class AbstractCollector
taskExecutionContext
- The task execution context wrapping the task that failed.elapsedTime
- Time of executionelapsedTimeNanos
- throwable
- The reason (if specified) for the failureprotected void closeOpenResources()
closeOpenResources
in class AbstractCollector
protected void initializeCollector(BasherContext basherContext) throws Exception
initializeCollector
in class AbstractCollector
Exception
public void notRun(TaskExecutionContext taskExecutionContext, long elapsedTime, long elapsedTimeNanos)
notRun
in interface Collector
notRun
in class AbstractCollector
taskExecutionContext
- The task that didn't run.elapsedTime
- Time of executionelapsedTimeNanos
- protected void dumpAverage(Average average)
Average
to the averag file.
average
- The average to write to diskprotected abstract String formatAverage(Average average)
protected abstract String formatExecution(String taskName, long elapsedTime, long elapsedTimeNanos)
protected void writeToFile(AbstractFileCollector.Type type, String taskName, long elapsedTime, long elapsedTimeNanos)
type
- taskName
- The name of the task (used for the filename as well)elapsedTime
- Time the task took to executeelapsedTimeNanos
- public Average markAverage()
markAverage
in interface Collector
markAverage
in class AbstractCollector
protected BufferedWriter getWriter(String fileKey, AbstractFileCollector.Classifier classifier, Object... headerParams) throws IOException
fileKey
- The identifier of the bufferclassifier
-
IOException
- If the retrieval (create) fails
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |