Class AbstractThreadGroup
java.lang.Object
org.apache.jmeter.testelement.AbstractTestElement
org.apache.jmeter.threads.AbstractThreadGroup
- All Implemented Interfaces:
Serializable, Cloneable, Controller, Searchable, TestElement, JMeterThreadMonitor, TestCompilerHelper
- Direct Known Subclasses:
ThreadGroup
public abstract class AbstractThreadGroup
extends AbstractTestElement
implements Serializable, Controller, JMeterThreadMonitor, TestCompilerHelper
ThreadGroup holds the settings for a JMeter thread group.
This class is intended to be ThreadSafe.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringNumber of threads in the thread groupstatic final StringAction to be taken when a Sampler error occursstatic final StringContinue, i.e. ignore sampler errorsstatic final StringStart next loop for current thread if sampler error occursstatic final StringStop test (all threads) if sampler error occurs, the entire test is stopped at the end of any current samplesstatic final StringStop test NOW (all threads) if sampler error occurs, the entire test is stopped abruptly.static final StringStop current thread if sampler error occursFields inherited from interface TestElement
COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidControllers have to notify listeners of when they begin an iteration through their sub-elements.voidaddTestElement(TestElement child) Add a test element.final booleanaddTestElementOnce(TestElement child) Add child test element only if it has not already been added.intGet the number of active threadsintGet the number of threads.booleanCheck if a sampler error should cause thread to start next loop.booleanCheck if a sampler error should cause test to stop.booleanCheck if a sampler error should cause test to stop now.booleanCheck if a sampler error should cause thread to stop.Get the sampler controller.voidCalled to initialize a controller at the beginning of a test iteration.booleanisDone()Indicates whether the Controller is done delivering Samplers for the rest of the test.next()Delivers the next Sampler or nullabstract intvoidremoveIterationListener(LoopIterationListener iterationListener) Unregister IterationListenervoidsetNumThreads(int numThreads) Set the total number of threads to startvoidSet the sampler controller.abstract voidstart(int groupCount, ListenerNotifier notifier, ListedHashTree threadGroupTree, StandardJMeterEngine engine) voidStart next iteration after an errorabstract voidstop()abstract booleanstopThread(String threadName, boolean now) abstract voidvoidNOOPabstract booleanabstract voidMethods inherited from class AbstractTestElement
addPropertiesValues, addProperty, addProperty, canRemove, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traversePropertyMethods inherited from class Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface JMeterThreadMonitor
threadFinishedMethods inherited from interface TestElement
canRemove, clear, clearTestElementChildren, clone, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse
-
Field Details
-
ON_SAMPLE_ERROR
-
ON_SAMPLE_ERROR_CONTINUE
-
ON_SAMPLE_ERROR_START_NEXT_LOOP
Start next loop for current thread if sampler error occurs- See Also:
-
ON_SAMPLE_ERROR_STOPTHREAD
Stop current thread if sampler error occurs- See Also:
-
ON_SAMPLE_ERROR_STOPTEST
Stop test (all threads) if sampler error occurs, the entire test is stopped at the end of any current samples- See Also:
-
ON_SAMPLE_ERROR_STOPTEST_NOW
Stop test NOW (all threads) if sampler error occurs, the entire test is stopped abruptly. Any current samplers are interrupted if possible.- See Also:
-
NUM_THREADS
-
MAIN_CONTROLLER
- See Also:
-
-
Constructor Details
-
AbstractThreadGroup
public AbstractThreadGroup()
-
-
Method Details
-
isDone
public boolean isDone()Indicates whether the Controller is done delivering Samplers for the rest of the test. When the top-level controller returns true to JMeterThread, the thread is complete.- Specified by:
isDonein interfaceController- Returns:
- boolean
-
next
Delivers the next Sampler or null- Specified by:
nextin interfaceController- Returns:
- org.apache.jmeter.samplers.Sampler or null
-
getSamplerController
Get the sampler controller.- Returns:
- the sampler controller.
-
setSamplerController
Set the sampler controller.- Parameters:
c- the sampler controller.
-
addTestElement
Add a test element.- Specified by:
addTestElementin interfaceTestElement- Overrides:
addTestElementin classAbstractTestElement- Parameters:
child- the test element to add.
-
addTestElementOnce
Add child test element only if it has not already been added.Only for use by TestCompiler.
- Specified by:
addTestElementOncein interfaceTestCompilerHelper- Parameters:
child- theTestElementto be added- Returns:
trueif the child was added
-
addIterationListener
Controllers have to notify listeners of when they begin an iteration through their sub-elements.- Specified by:
addIterationListenerin interfaceController- Parameters:
lis- TheLoopIterationListenerto add
-
removeIterationListener
Unregister IterationListener- Specified by:
removeIterationListenerin interfaceController- Parameters:
iterationListener-LoopIterationListener
-
initialize
public void initialize()Called to initialize a controller at the beginning of a test iteration.- Specified by:
initializein interfaceController
-
startNextLoop
public void startNextLoop()Start next iteration after an error -
triggerEndOfLoop
-
setNumThreads
public void setNumThreads(int numThreads) Set the total number of threads to start- Parameters:
numThreads- the number of threads.
-
getNumberOfThreads
public int getNumberOfThreads()Get the number of active threads- Returns:
- the number of active threads
-
getNumThreads
public int getNumThreads()Get the number of threads.- Returns:
- the number of threads.
-
getOnErrorStartNextLoop
public boolean getOnErrorStartNextLoop()Check if a sampler error should cause thread to start next loop.- Returns:
- true if thread should start next loop
-
getOnErrorStopThread
public boolean getOnErrorStopThread()Check if a sampler error should cause thread to stop.- Returns:
- true if thread should stop
-
getOnErrorStopTest
public boolean getOnErrorStopTest()Check if a sampler error should cause test to stop.- Returns:
- true if test (all threads) should stop
-
getOnErrorStopTestNow
public boolean getOnErrorStopTestNow()Check if a sampler error should cause test to stop now.- Returns:
- true if test (all threads) should stop immediately
-
stopThread
-
numberOfActiveThreads
public abstract int numberOfActiveThreads() -
start
public abstract void start(int groupCount, ListenerNotifier notifier, ListedHashTree threadGroupTree, StandardJMeterEngine engine) -
verifyThreadsStopped
public abstract boolean verifyThreadsStopped() -
waitThreadsStopped
public abstract void waitThreadsStopped() -
tellThreadsToStop
public abstract void tellThreadsToStop() -
stop
public abstract void stop()
-