Class ThreadGroup
-
- All Implemented Interfaces:
-
java.io.Serializable
,java.lang.Cloneable
,org.apache.jmeter.control.Controller
,org.apache.jmeter.gui.Searchable
,org.apache.jmeter.testelement.TestElement
,org.apache.jmeter.threads.JMeterThreadMonitor
,org.apache.jmeter.threads.TestCompilerHelper
public class ThreadGroup extends AbstractThreadGroup
ThreadGroup holds the settings for a JMeter thread group. This class is intended to be ThreadSafe.
-
-
Field Summary
Fields Modifier and Type Field Description public final static String
RAMP_TIME
public final static String
DELAYED_START
public final static String
SCHEDULER
public final static String
DURATION
public final static String
DELAY
public final static Duration
DEFAULT_THREAD_STOP_TIMEOUT
public final static String
ON_SAMPLE_ERROR
public final static String
ON_SAMPLE_ERROR_CONTINUE
public final static String
ON_SAMPLE_ERROR_START_NEXT_LOOP
public final static String
ON_SAMPLE_ERROR_STOPTHREAD
public final static String
ON_SAMPLE_ERROR_STOPTEST
public final static String
ON_SAMPLE_ERROR_STOPTEST_NOW
public final static String
NUM_THREADS
public final static String
MAIN_CONTROLLER
public final static String
IS_SAME_USER_ON_NEXT_ITERATION
private transient boolean
runningVersion
public transient JMeterContext
threadContext
public transient String
threadName
public final static TestElement.Companion
Companion
public final static String
NAME
public final static String
GUI_CLASS
public final static String
ENABLED
public final static String
TEST_CLASS
public final static String
COMMENTS
-
Constructor Summary
Constructors Constructor Description ThreadGroup()
No-arg constructor.
-
Method Summary
Modifier and Type Method Description ThreadGroupSchema
getSchema()
PropertiesAccessor<out ThreadGroup, out ThreadGroupSchema>
getProps()
Allows type-safe accessors to the properties of the current element. void
setScheduler(boolean scheduler)
Set whether scheduler is being used boolean
getScheduler()
Get whether scheduler is being used long
getDuration()
Get the desired duration of the thread group test run void
setDuration(long duration)
Set the desired duration of the thread group test run long
getDelay()
Get the startup delay void
setDelay(long delay)
Set the startup delay void
setRampUp(int rampUp)
Set the ramp-up value. int
getRampUp()
Get the ramp-up value. void
start(int groupNum, ListenerNotifier notifier, ListedHashTree threadGroupTree, StandardJMeterEngine engine)
Start the ThreadGroup JMeterThread
addNewThread(int delay, StandardJMeterEngine engine)
Add a new JMeterThread to this ThreadGroup for engine boolean
stopThread(String threadName, boolean now)
Stop thread called threadName: - stop JMeter thread
- interrupt JMeter thread
- interrupt underlying thread
void
threadFinished(JMeterThread thread)
Called by JMeterThread when it finishes void
tellThreadsToStop(boolean now)
void
tellThreadsToStop()
This is an immediate stop interrupting: - current running threads
- current running samplers
void
stop()
This is a clean shutdown. int
numberOfActiveThreads()
boolean
verifyThreadsStopped()
void
waitThreadsStopped()
Wait for all Group Threads to stop -
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addTestElement, canRemove, clear, clearTestElementChildren, clone, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getPropertyOrNull, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse
-
Methods inherited from class org.apache.jmeter.threads.AbstractThreadGroup
addIterationListener, addTestElement, addTestElementOnce, breakThreadLoop, cloneTree, getNumThreads, getNumberOfThreads, getOnErrorStartNextLoop, getOnErrorStopTest, getOnErrorStopTestNow, getOnErrorStopThread, getSamplerController, initialize, isDone, isSameUserOnNextIteration, next, removeIterationListener, setIsSameUserOnNextIteration, setNumThreads, setSamplerController, startNextLoop, triggerEndOfLoop
-
Methods inherited from class org.apache.jmeter.control.Controller
addIterationListener
-
Methods inherited from class org.apache.jmeter.testelement.TestElement
addTestElement, canRemove, clear, clearTestElementChildren, clone, get, get, get, get, get, get, get, get, get, getComment, getName, getOrCreate, getOrCreate, getOrNull, getOrNull, getOrNull, getProperty, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyOrNull, getProps, getSchema, getString, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, removed, set, setComment, setEnabled, setName, setProperty, setTemporary, traverse
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getSchema
ThreadGroupSchema getSchema()
-
getProps
@NotNull() PropertiesAccessor<out ThreadGroup, out ThreadGroupSchema> getProps()
Allows type-safe accessors to the properties of the current element. Note: when overriding the method, ensure you emit wildcards. For instance: JMeterElementInstance<? extends TestPlanClass> getProps() { return ... }
-
setScheduler
void setScheduler(boolean scheduler)
Set whether scheduler is being used
- Parameters:
scheduler
- true is scheduler is to be used
-
getScheduler
boolean getScheduler()
Get whether scheduler is being used
- Returns:
true if scheduler is being used
-
getDuration
long getDuration()
Get the desired duration of the thread group test run
- Returns:
the duration (in secs)
-
setDuration
void setDuration(long duration)
Set the desired duration of the thread group test run
- Parameters:
duration
- in seconds
-
getDelay
long getDelay()
Get the startup delay
- Returns:
the delay (in secs)
-
setDelay
void setDelay(long delay)
Set the startup delay
- Parameters:
delay
- in seconds
-
setRampUp
void setRampUp(int rampUp)
Set the ramp-up value.
- Parameters:
rampUp
- the ramp-up value.
-
getRampUp
int getRampUp()
Get the ramp-up value.
- Returns:
the ramp-up value.
-
start
void start(int groupNum, ListenerNotifier notifier, ListedHashTree threadGroupTree, StandardJMeterEngine engine)
Start the ThreadGroup
- Parameters:
notifier
- ListenerNotifierthreadGroupTree
- ListedHashTreeengine
- StandardJMeterEngine
-
addNewThread
JMeterThread addNewThread(int delay, StandardJMeterEngine engine)
Add a new JMeterThread to this ThreadGroup for engine
- Parameters:
delay
- Delay in millisecondsengine
- StandardJMeterEngine- Returns:
-
stopThread
boolean stopThread(String threadName, boolean now)
Stop thread called threadName:
- stop JMeter thread
- interrupt JMeter thread
- interrupt underlying thread
- Parameters:
threadName
- String thread namenow
- boolean for stop- Returns:
true if thread stopped
-
threadFinished
void threadFinished(JMeterThread thread)
Called by JMeterThread when it finishes
-
tellThreadsToStop
void tellThreadsToStop(boolean now)
-
tellThreadsToStop
void tellThreadsToStop()
This is an immediate stop interrupting:
- current running threads
- current running samplers
-
numberOfActiveThreads
int numberOfActiveThreads()
- Returns:
number of active threads
-
verifyThreadsStopped
boolean verifyThreadsStopped()
- Returns:
boolean true if all threads stopped
-
waitThreadsStopped
void waitThreadsStopped()
Wait for all Group Threads to stop
-
-
-