Class 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:
  • Field Details

  • Constructor Details

    • ThreadGroup

      public ThreadGroup()
      No-arg constructor.
  • Method Details

    • setScheduler

      public void setScheduler(boolean scheduler)
      Set whether scheduler is being used
      scheduler - true is scheduler is to be used
    • getScheduler

      public boolean getScheduler()
      Get whether scheduler is being used
      true if scheduler is being used
    • getDuration

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

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

      public long getDelay()
      Get the startup delay
      the delay (in secs)
    • setDelay

      public void setDelay(long delay)
      Set the startup delay
      delay - in seconds
    • setRampUp

      public void setRampUp(int rampUp)
      Set the ramp-up value.
      rampUp - the ramp-up value.
    • getRampUp

      public int getRampUp()
      Get the ramp-up value.
      the ramp-up value.
    • start

      public void start(int groupNum, ListenerNotifier notifier, ListedHashTree threadGroupTree, StandardJMeterEngine engine)
      Description copied from class: AbstractThreadGroup
      Start the ThreadGroup
      Specified by:
      start in class AbstractThreadGroup
      groupNum - group number
      notifier - ListenerNotifier
      threadGroupTree - ListedHashTree
      engine - StandardJMeterEngine
    • addNewThread

      public JMeterThread addNewThread(int delay, StandardJMeterEngine engine)
      Description copied from class: AbstractThreadGroup
      Add a new JMeterThread to this ThreadGroup for engine
      Specified by:
      addNewThread in class AbstractThreadGroup
      delay - Delay in milliseconds
      engine - StandardJMeterEngine
    • stopThread

      public boolean stopThread(String threadName, boolean now)
      Stop thread called threadName:
      1. stop JMeter thread
      2. interrupt JMeter thread
      3. interrupt underlying thread
      Specified by:
      stopThread in class AbstractThreadGroup
      threadName - String thread name
      now - boolean for stop
      true if thread stopped
    • threadFinished

      public void threadFinished(JMeterThread thread)
      Called by JMeterThread when it finishes
    • tellThreadsToStop

      public void tellThreadsToStop(boolean now)
    • tellThreadsToStop

      public void tellThreadsToStop()
      This is an immediate stop interrupting:
      • current running threads
      • current running samplers
      For each thread, invoke:
      Specified by:
      tellThreadsToStop in class AbstractThreadGroup
    • stop

      public void stop()
      This is a clean shutdown. For each thread, invoke:
      Specified by:
      stop in class AbstractThreadGroup
    • numberOfActiveThreads

      public int numberOfActiveThreads()
      Specified by:
      numberOfActiveThreads in class AbstractThreadGroup
      number of active threads
    • verifyThreadsStopped

      public boolean verifyThreadsStopped()
      Specified by:
      verifyThreadsStopped in class AbstractThreadGroup
      boolean true if all threads stopped
    • waitThreadsStopped

      public void waitThreadsStopped()
      Wait for all Group Threads to stop
      Specified by:
      waitThreadsStopped in class AbstractThreadGroup