org.eigenbase.test.concurrent
Class ConcurrentTestTimedCommandGenerator
java.lang.Object
org.eigenbase.test.concurrent.ConcurrentTestCommandGenerator
org.eigenbase.test.concurrent.ConcurrentTestTimedCommandGenerator
public class ConcurrentTestTimedCommandGenerator
- extends ConcurrentTestCommandGenerator
ConcurrentTestTimedCommandGenerator extends ConcurrentTestCommandGenerator
and repeats the configured command
sequence until a certain amount of time has elapsed.
The command sequence is always completed in full, even if the time limit
has been exceeded. Therefore, the time limit can only be considered the
minimum length of time that the test will run and not a guarantee of how long
the test will take.
- Version:
- $Id: //open/dev/farrago/src/org/eigenbase/test/concurrent/ConcurrentTestTimedCommandGenerator.java#1 $
- Author:
- Stephan Zuercher
Constructor Summary |
ConcurrentTestTimedCommandGenerator(int runTimeSeconds)
Constructs a new ConcurrentTestTimedCommandGenerator that will run
for at least the given amount of time. |
Methods inherited from class org.eigenbase.test.concurrent.ConcurrentTestCommandGenerator |
addCloseCommand, addCommand, addCommitCommand, addDdlCommand, addExplainCommand, addFetchAndCompareCommand, addInsertCommand, addPrepareCommand, addRollbackCommand, addSleepCommand, addSynchronizationCommand, customErrorHandler, execute, failed, getCommands, getFailedThreads, getThreadIds, getThreadName, hasValidSynchronization, innerExecute, postExecute, requiresCustomErrorHandling, setDataSource, setDebug, setDebug, setThreadName, synchronizeCommandSets |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
runTimeSeconds
private int runTimeSeconds
endTimeMillis
private long endTimeMillis
ConcurrentTestTimedCommandGenerator
public ConcurrentTestTimedCommandGenerator(int runTimeSeconds)
- Constructs a new ConcurrentTestTimedCommandGenerator that will run
for at least the given amount of time. See
ConcurrentTestTimedCommandGenerator
for more information on the
semantics of run-time length.
- Parameters:
runTimeSeconds
- minimum run-time length, in seconds
getCommandIterator
Iterator getCommandIterator(Integer threadId)
- Retrieves an Iterator based on the configured commands. This Iterator,
when it reaches the end of the command list will compare the current time
with the test's end time. If there is time left, the Iterator will repeat
the command sequence.
The test's end time is computed by taking the value of
System.currentTimeMillis()
the first time this method is called
(across all thread IDs) and adding the configured run time.
- Overrides:
getCommandIterator
in class ConcurrentTestCommandGenerator
- Parameters:
threadId
- the thread ID to get an Iterator on
printCommands
void printCommands(PrintStream out,
Integer threadId)
- Outputs command sequence and notes how long the sequence will be
repeated.
- Overrides:
printCommands
in class ConcurrentTestCommandGenerator