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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      ThreadGroup() No-arg constructor.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • 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
      For each thread, invoke:
      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
    • Constructor Detail

      • ThreadGroup

        ThreadGroup()
        No-arg constructor.
    • Method Detail

      • 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.

      • stopThread

         boolean stopThread(String threadName, boolean now)

        Stop thread called threadName:

        • stop JMeter thread
        • interrupt JMeter thread
        • interrupt underlying thread
        Parameters:
        threadName - String thread name
        now - boolean for stop
        Returns:

        true if thread stopped

      • tellThreadsToStop

         void tellThreadsToStop()

        This is an immediate stop interrupting:

        • current running threads
        • current running samplers
        For each thread, invoke:
      • stop

         void stop()

        This is a clean shutdown. For each thread, invoke:

        • stop - set stop flag