org.apache.jmeter.threads

Class ThreadGroup

Implemented Interfaces:
Cloneable, Serializable, Controller, TestElement

public class ThreadGroup
extends AbstractTestElement
implements Serializable, Controller

ThreadGroup holds the settings for a JMeter thread group. This class is intended to be ThreadSafe.

Field Summary

static String
DELAY
Scheduler start delay, overrides start time
static String
DURATION
Scheduler duration, overrides end time
static String
END_TIME
Scheduler absolute end time
static String
MAIN_CONTROLLER
static String
NUM_THREADS
Number of threads in the thread group
static String
ON_SAMPLE_ERROR
Action to be taken when a Sampler error occurs
static String
ON_SAMPLE_ERROR_CONTINUE
Continue, i.e. ignore sampler errors
static String
ON_SAMPLE_ERROR_STOPTEST
Stop test (all threads) if sampler error occurs
static String
ON_SAMPLE_ERROR_STOPTEST_NOW
Stop test NOW (all threads) if sampler error occurs
static String
ON_SAMPLE_ERROR_STOPTHREAD
Stop current thread if sampler error occurs
static String
RAMP_TIME
Ramp-up time
static String
SCHEDULER
Whether scheduler is being used
static String
START_TIME
Scheduler absolute start time

Fields inherited from interface org.apache.jmeter.testelement.TestElement

COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS

Constructor Summary

ThreadGroup()
No-arg constructor.

Method Summary

void
addIterationListener(LoopIterationListener lis)
void
addTestElement(TestElement child)
Add a test element.
long
getDelay()
Get the startup delay
long
getDuration()
Get the desired duration of the thread group test run
long
getEndTime()
Get the end time value.
int
getNumThreads()
Get the number of threads.
int
getNumberOfThreads()
Get the number of active threads
boolean
getOnErrorStopTest()
Check if a sampler error should cause test to stop.
boolean
getOnErrorStopTestNow()
Check if a sampler error should cause test to stop now.
boolean
getOnErrorStopThread()
Check if a sampler error should cause thread to stop.
int
getRampUp()
Get the ramp-up value.
Controller
getSamplerController()
Get the sampler controller.
boolean
getScheduler()
Get whether scheduler is being used
long
getStartTime()
Get the absolute start time value.
void
initialize()
boolean
isDone()
Sampler
next()
void
setDelay(long delay)
Set the startup delay
void
setDuration(long duration)
Set the desired duration of the thread group test run
void
setEndTime(long etime)
Set the EndTime value.
void
setNumThreads(int numThreads)
Set the total number of threads to start
void
setRampUp(int rampUp)
Set the ramp-up value.
void
setSamplerController(LoopController c)
Set the sampler controller.
void
setScheduler(boolean Scheduler)
Set whether scheduler is being used
void
setStartTime(long stime)
Set the absolute StartTime value.

Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

addProperty, addTestElement, canRemove, clear, clearTemporary, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty

Field Details

DELAY

public static final String DELAY
Scheduler start delay, overrides start time

DURATION

public static final String DURATION
Scheduler duration, overrides end time

END_TIME

public static final String END_TIME
Scheduler absolute end time

MAIN_CONTROLLER

public static final String MAIN_CONTROLLER

NUM_THREADS

public static final String NUM_THREADS
Number of threads in the thread group

ON_SAMPLE_ERROR

public static final String ON_SAMPLE_ERROR
Action to be taken when a Sampler error occurs

ON_SAMPLE_ERROR_CONTINUE

public static final String ON_SAMPLE_ERROR_CONTINUE
Continue, i.e. ignore sampler errors

ON_SAMPLE_ERROR_STOPTEST

public static final String ON_SAMPLE_ERROR_STOPTEST
Stop test (all threads) if sampler error occurs

ON_SAMPLE_ERROR_STOPTEST_NOW

public static final String ON_SAMPLE_ERROR_STOPTEST_NOW
Stop test NOW (all threads) if sampler error occurs

ON_SAMPLE_ERROR_STOPTHREAD

public static final String ON_SAMPLE_ERROR_STOPTHREAD
Stop current thread if sampler error occurs

RAMP_TIME

public static final String RAMP_TIME
Ramp-up time

SCHEDULER

public static final String SCHEDULER
Whether scheduler is being used

START_TIME

public static final String START_TIME
Scheduler absolute start time

Constructor Details

ThreadGroup

public ThreadGroup()
No-arg constructor.

Method Details

addIterationListener

public void addIterationListener(LoopIterationListener lis)
Specified by:
addIterationListener in interface Controller

addTestElement

public void addTestElement(TestElement child)
Add a test element.
Specified by:
addTestElement in interface TestElement
Overrides:
addTestElement in interface AbstractTestElement
Parameters:
child - the test element to add.

getDelay

public long getDelay()
Get the startup delay
Returns:
the delay (in secs)

getDuration

public long getDuration()
Get the desired duration of the thread group test run
Returns:
the duration (in secs)

getEndTime

public long getEndTime()
Get the end time value.
Returns:
the end time value.

getNumThreads

public int getNumThreads()
Get the number of threads.
Returns:
the number of threads.

getNumberOfThreads

public int getNumberOfThreads()
Get the number of active threads

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

getOnErrorStopThread

public boolean getOnErrorStopThread()
Check if a sampler error should cause thread to stop.
Returns:
true if thread should stop

getRampUp

public int getRampUp()
Get the ramp-up value.
Returns:
the ramp-up value.

getSamplerController

public Controller getSamplerController()
Get the sampler controller.
Returns:
the sampler controller.

getScheduler

public boolean getScheduler()
Get whether scheduler is being used
Returns:
true if scheduler is being used

getStartTime

public long getStartTime()
Get the absolute start time value.
Returns:
the start time value.

initialize

public void initialize()
Specified by:
initialize in interface Controller

isDone

public boolean isDone()
Specified by:
isDone in interface Controller

next

public Sampler next()
Specified by:
next in interface Controller

setDelay

public void setDelay(long delay)
Set the startup delay
Parameters:
delay - in seconds

setDuration

public void setDuration(long duration)
Set the desired duration of the thread group test run
Parameters:
duration - in seconds

setEndTime

public void setEndTime(long etime)
Set the EndTime value.
Parameters:
etime - - the EndTime value.

setNumThreads

public void setNumThreads(int numThreads)
Set the total number of threads to start
Parameters:
numThreads - the number of threads.

setRampUp

public void setRampUp(int rampUp)
Set the ramp-up value.
Parameters:
rampUp - the ramp-up value.

setSamplerController

public void setSamplerController(LoopController c)
Set the sampler controller.
Parameters:
c - the sampler controller.

setScheduler

public void setScheduler(boolean Scheduler)
Set whether scheduler is being used
Parameters:
Scheduler - true is scheduler is to be used

setStartTime

public void setStartTime(long stime)
Set the absolute StartTime value.
Parameters:
stime - - the StartTime value.

Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.