Package org.apache.jmeter.threads
Class ThreadGroup
- java.lang.Object
-
- org.apache.jmeter.testelement.AbstractTestElement
-
- org.apache.jmeter.threads.AbstractThreadGroup
-
- org.apache.jmeter.threads.ThreadGroup
-
- All Implemented Interfaces:
Serializable,Cloneable,Controller,Searchable,TestElement,JMeterThreadMonitor,TestCompilerHelper
- Direct Known Subclasses:
PostThreadGroup,SetupThreadGroup
public class ThreadGroup extends AbstractThreadGroup
ThreadGroup holds the settings for a JMeter thread group. This class is intended to be ThreadSafe.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringDELAYScheduler start delay, overrides start timestatic StringDELAYED_STARTWhether thread startup is delayed until requiredstatic StringDURATIONScheduler duration, overrides end timestatic StringEND_TIMEScheduler absolute end timestatic StringRAMP_TIMERamp-up timestatic StringSCHEDULERWhether scheduler is being usedstatic StringSTART_TIMEScheduler absolute start time-
Fields inherited from class org.apache.jmeter.threads.AbstractThreadGroup
MAIN_CONTROLLER, NUM_THREADS, ON_SAMPLE_ERROR, ON_SAMPLE_ERROR_CONTINUE, ON_SAMPLE_ERROR_START_NEXT_LOOP, ON_SAMPLE_ERROR_STOPTEST, ON_SAMPLE_ERROR_STOPTEST_NOW, ON_SAMPLE_ERROR_STOPTHREAD
-
Fields inherited from interface org.apache.jmeter.testelement.TestElement
COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS
-
-
Constructor Summary
Constructors Constructor Description ThreadGroup()No-arg constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetDelay()Get the startup delaylonggetDuration()Get the desired duration of the thread group test runlonggetEndTime()Get the end time value.intgetRampUp()Get the ramp-up value.booleangetScheduler()Get whether scheduler is being usedlonggetStartTime()Get the absolute start time value.intnumberOfActiveThreads()voidsetDelay(long delay)Set the startup delayvoidsetDuration(long duration)Set the desired duration of the thread group test runvoidsetEndTime(long etime)Set the EndTime value.voidsetRampUp(int rampUp)Set the ramp-up value.voidsetScheduler(boolean Scheduler)Set whether scheduler is being usedvoidsetStartTime(long stime)Set the absolute StartTime value.voidstart(int groupCount, ListenerNotifier notifier, ListedHashTree threadGroupTree, StandardJMeterEngine engine)voidstop()For each thread, invoke:JMeterThread.stop()- set stop flagbooleanstopThread(String threadName, boolean now)Stop thread called threadName: stop JMeter thread interrupt JMeter thread interrupt underlying threadvoidtellThreadsToStop()For each thread, invoke:JMeterThread.stop()- set stop flagJMeterThread.interrupt()- interrupt samplerThread.interrupt()- interrupt JVM threadvoidthreadFinished(JMeterThread thread)Called by JMeterThread when it finishesbooleanverifyThreadsStopped()voidwaitThreadsStopped()Wait for all Group Threads to stop-
Methods inherited from class org.apache.jmeter.threads.AbstractThreadGroup
addIterationListener, addTestElement, addTestElementOnce, getNumberOfThreads, getNumThreads, getOnErrorStartNextLoop, getOnErrorStopTest, getOnErrorStopTestNow, getOnErrorStopThread, getSamplerController, initialize, isDone, next, removeIterationListener, setNumThreads, setSamplerController, startNextLoop, triggerEndOfLoop
-
Methods inherited from class org.apache.jmeter.testelement.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, traverseProperty
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.jmeter.testelement.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 Detail
-
RAMP_TIME
public static final String RAMP_TIME
Ramp-up time- See Also:
- Constant Field Values
-
DELAYED_START
public static final String DELAYED_START
Whether thread startup is delayed until required- See Also:
- Constant Field Values
-
SCHEDULER
public static final String SCHEDULER
Whether scheduler is being used- See Also:
- Constant Field Values
-
START_TIME
public static final String START_TIME
Scheduler absolute start time- See Also:
- Constant Field Values
-
END_TIME
public static final String END_TIME
Scheduler absolute end time- See Also:
- Constant Field Values
-
DURATION
public static final String DURATION
Scheduler duration, overrides end time- See Also:
- Constant Field Values
-
DELAY
public static final String DELAY
Scheduler start delay, overrides start time- See Also:
- Constant Field Values
-
-
Method Detail
-
setScheduler
public void setScheduler(boolean Scheduler)
Set whether scheduler is being used- Parameters:
Scheduler- true is scheduler is to be used
-
getScheduler
public boolean getScheduler()
Get whether scheduler is being used- Returns:
- true if scheduler is being used
-
setStartTime
public void setStartTime(long stime)
Set the absolute StartTime value.- Parameters:
stime- - the StartTime value.
-
getStartTime
public long getStartTime()
Get the absolute start time value.- Returns:
- the start time value.
-
getDuration
public long getDuration()
Get the desired duration of the thread group test run- Returns:
- the duration (in secs)
-
setDuration
public void setDuration(long duration)
Set the desired duration of the thread group test run- Parameters:
duration- in seconds
-
getDelay
public long getDelay()
Get the startup delay- Returns:
- the delay (in secs)
-
setDelay
public void setDelay(long delay)
Set the startup delay- Parameters:
delay- in seconds
-
setEndTime
public void setEndTime(long etime)
Set the EndTime value.- Parameters:
etime- - the EndTime value.
-
getEndTime
public long getEndTime()
Get the end time value.- Returns:
- the end time value.
-
setRampUp
public void setRampUp(int rampUp)
Set the ramp-up value.- Parameters:
rampUp- the ramp-up value.
-
getRampUp
public int getRampUp()
Get the ramp-up value.- Returns:
- the ramp-up value.
-
start
public void start(int groupCount, ListenerNotifier notifier, ListedHashTree threadGroupTree, StandardJMeterEngine engine)- Specified by:
startin classAbstractThreadGroup
-
stopThread
public boolean stopThread(String threadName, boolean now)
Stop thread called threadName:- stop JMeter thread
- interrupt JMeter thread
- interrupt underlying thread
- Specified by:
stopThreadin classAbstractThreadGroup- Parameters:
threadName- String thread namenow- boolean for stop- Returns:
- true if thread stopped
-
threadFinished
public void threadFinished(JMeterThread thread)
Called by JMeterThread when it finishes
-
tellThreadsToStop
public void tellThreadsToStop()
For each thread, invoke:JMeterThread.stop()- set stop flagJMeterThread.interrupt()- interrupt samplerThread.interrupt()- interrupt JVM thread
- Specified by:
tellThreadsToStopin classAbstractThreadGroup
-
stop
public void stop()
For each thread, invoke:JMeterThread.stop()- set stop flag
- Specified by:
stopin classAbstractThreadGroup
-
numberOfActiveThreads
public int numberOfActiveThreads()
- Specified by:
numberOfActiveThreadsin classAbstractThreadGroup- Returns:
- number of active threads
-
verifyThreadsStopped
public boolean verifyThreadsStopped()
- Specified by:
verifyThreadsStoppedin classAbstractThreadGroup- Returns:
- boolean true if all threads stopped
-
waitThreadsStopped
public void waitThreadsStopped()
Wait for all Group Threads to stop- Specified by:
waitThreadsStoppedin classAbstractThreadGroup
-
-