Apache JMeter

org.apache.jmeter.threads
Class ThreadGroup

java.lang.Object
  extended byorg.apache.jmeter.testelement.AbstractTestElement
      extended byorg.apache.jmeter.threads.ThreadGroup
All Implemented Interfaces:
Cloneable, Controller, SampleListener, Serializable, TestElement

public class ThreadGroup
extends AbstractTestElement
implements SampleListener, Serializable, Controller

ThreadGroup

See Also:
Serialized Form

Field Summary
static String DELAY
           
static String DURATION
           
static String END_TIME
           
static String MAIN_CONTROLLER
           
static String NUM_THREADS
           
static String ON_SAMPLE_ERROR
           
static String ON_SAMPLE_ERROR_CONTINUE
           
static String ON_SAMPLE_ERROR_STOPTEST
           
static String ON_SAMPLE_ERROR_STOPTHREAD
           
static String RAMP_TIME
           
static String SCHEDULER
           
static String 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)
          Controllers have to notify listeners of when they begin an iteration through their sub-elements.
 void addTestElement(TestElement child)
          Add a test element.
 int getDefaultNumThreads()
          Get the default number of threads.
 int getDefaultRampUp()
          Get the default ramp-up value.
 long getDelay()
          Get the delay
 long getDuration()
          Get the duration
 long getEndTime()
          Get the end time value.
 int getNumberOfThreads()
           
 int getNumThreads()
          Get the number of threads.
 boolean getOnErrorStopTest()
          Check if a sampler error should cause test to stop.
 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 the Scheduler value.
 long getStartTime()
          Get the start time value.
 void initialize()
          Called to initialize a controller at the beginning of a test iteration.
 boolean isDone()
          Indicates whether the Controller is done delivering Samplers for the rest of the test.
 Sampler next()
          Delivers the next Sampler or null
 void sampleOccurred(SampleEvent e)
          A sample has occurred.
 void sampleStarted(SampleEvent e)
          A sample has started.
 void sampleStopped(SampleEvent e)
          A sample has stopped.
 void setDelay(long delay)
          Set the delay
 void setDuration(long duration)
          Set the duration
 void setEndTime(long etime)
          Set the EndTime value.
 void setNumThreads(int numThreads)
          Set the 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 the Scheduler value.
 void setStartTime(long stime)
          Set the StartTime value.
 
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addProperty, canRemove, clear, clearTemporary, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setName, 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, clone, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setComment, setName, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse
 

Field Detail

NUM_THREADS

public static final String NUM_THREADS
See Also:
Constant Field Values

RAMP_TIME

public static final String RAMP_TIME
See Also:
Constant Field Values

MAIN_CONTROLLER

public static final String MAIN_CONTROLLER
See Also:
Constant Field Values

SCHEDULER

public static final String SCHEDULER
See Also:
Constant Field Values

START_TIME

public static final String START_TIME
See Also:
Constant Field Values

END_TIME

public static final String END_TIME
See Also:
Constant Field Values

DURATION

public static final String DURATION
See Also:
Constant Field Values

DELAY

public static final String DELAY
See Also:
Constant Field Values

ON_SAMPLE_ERROR

public static final String ON_SAMPLE_ERROR
See Also:
Constant Field Values

ON_SAMPLE_ERROR_CONTINUE

public static final String ON_SAMPLE_ERROR_CONTINUE
See Also:
Constant Field Values

ON_SAMPLE_ERROR_STOPTHREAD

public static final String ON_SAMPLE_ERROR_STOPTHREAD
See Also:
Constant Field Values

ON_SAMPLE_ERROR_STOPTEST

public static final String ON_SAMPLE_ERROR_STOPTEST
See Also:
Constant Field Values
Constructor Detail

ThreadGroup

public ThreadGroup()
No-arg constructor.

Method Detail

setNumThreads

public void setNumThreads(int numThreads)
Set the number of threads to start

Parameters:
numThreads - the number of threads.

getNumberOfThreads

public int getNumberOfThreads()

isDone

public boolean isDone()
Description copied from interface: Controller
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:
isDone in interface Controller
Returns:
boolean

next

public Sampler next()
Description copied from interface: Controller
Delivers the next Sampler or null

Specified by:
next in interface Controller
Returns:
org.apache.jmeter.samplers.Sampler or null

setScheduler

public void setScheduler(boolean Scheduler)
Set the Scheduler value.

Parameters:
Scheduler - the Scheduler value.

getScheduler

public boolean getScheduler()
Get the Scheduler value.

Returns:
the Scheduler value.

setStartTime

public void setStartTime(long stime)
Set the StartTime value.

Parameters:
stime - - the StartTime value.

getStartTime

public long getStartTime()
Get the start time value.

Returns:
the start time value.

getDuration

public long getDuration()
Get the duration

Returns:
the duration (in secs)

setDuration

public void setDuration(long duration)
Set the duration

Parameters:
duration - in seconds

getDelay

public long getDelay()
Get the delay

Returns:
the delay (in secs)

setDelay

public void setDelay(long delay)
Set the 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.

getSamplerController

public Controller getSamplerController()
Get the sampler controller.

Returns:
the sampler controller.

setSamplerController

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

Parameters:
c - the sampler controller.

getNumThreads

public int getNumThreads()
Get the number of threads.

Returns:
the number of threads.

getDefaultNumThreads

public int getDefaultNumThreads()
Get the default number of threads.

Returns:
the default number of threads.

getDefaultRampUp

public int getDefaultRampUp()
Get the default ramp-up value.

Returns:
the default ramp-up value (in seconds).

addTestElement

public void addTestElement(TestElement child)
Add a test element.

Specified by:
addTestElement in interface TestElement
Overrides:
addTestElement in class AbstractTestElement
Parameters:
child - the test element to add.

sampleOccurred

public void sampleOccurred(SampleEvent e)
A sample has occurred.

Specified by:
sampleOccurred in interface SampleListener
Parameters:
e - the sample event.

sampleStarted

public void sampleStarted(SampleEvent e)
A sample has started.

Specified by:
sampleStarted in interface SampleListener
Parameters:
e - the sample event.

sampleStopped

public void sampleStopped(SampleEvent e)
A sample has stopped.

Specified by:
sampleStopped in interface SampleListener
Parameters:
e - the sample event

addIterationListener

public void addIterationListener(LoopIterationListener lis)
Description copied from interface: Controller
Controllers have to notify listeners of when they begin an iteration through their sub-elements.

Specified by:
addIterationListener in interface Controller

initialize

public void initialize()
Description copied from interface: Controller
Called to initialize a controller at the beginning of a test iteration.

Specified by:
initialize in interface Controller

getOnErrorStopThread

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

Returns:
true if should stop

getOnErrorStopTest

public boolean getOnErrorStopTest()
Check if a sampler error should cause test to stop.

Returns:
true if should stop

Apache JMeter

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