Package org.apache.jmeter.control

# Interface Controller

All Superinterfaces:
  `Cloneable`, `org.apache.jmeter.testelement.TestElement`

All Known Implementing Classes:
  `AbstractThreadGroup`, `CriticalSectionController`, `ForeachController`, `GenericController`, `IfController`, `IncludeController`, `InterleaveControl`, `LoopController`, `ModuleController`, `OnceOnlyController`, `PostThreadGroup`, `ProxyControl`, `RandomController`, `RandomOrderController`, `RecordingController`, `RunTime`, `SetupThreadGroup`, `SwitchController`, `TestFragmentController`, `ThreadGroup`, `ThroughputController`, `TransactionController`, `WhileController`

public interface Controller extends org.apache.jmeter.testelement.TestElement
This interface is used by JMeterThread in the following manner:

`while (running && (sampler = controller.next()) != null)`

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface org.apache.jmeter.testelement.TestElement

  `org.apache.jmeter.testelement.TestElement.Companion`

- ## Field Summary

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

  `COMMENTS, Companion, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addIterationListener(LoopIterationListener listener)`
  Controllers have to notify listeners of when they begin an iteration through their sub-elements.
  `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`
  `removeIterationListener(LoopIterationListener iterationListener)`
  Unregister IterationListener
  `void`
  `triggerEndOfLoop()`
  Trigger end of loop condition on controller (used by Start Next Loop feature)

  ### Methods inherited from interface 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, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getPropertyOrNull, getPropertyOrNull, getProps, getSchema, getString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removed, removeProperty, removeProperty, set, set, set, set, set, set, set, set, set, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse`

- ## Method Details

  - ### next

    Sampler next()
    Delivers the next Sampler or null
    Returns:
      org.apache.jmeter.samplers.Sampler or null

  - ### isDone

    boolean isDone()
    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.
    Returns:
      boolean

  - ### addIterationListener

    void addIterationListener(LoopIterationListener listener)
    Controllers have to notify listeners of when they begin an iteration through their sub-elements.
    Parameters:
      `listener` - The `LoopIterationListener` to add

  - ### initialize

    void initialize()
    Called to initialize a controller at the beginning of a test iteration.

  - ### removeIterationListener

    void removeIterationListener(LoopIterationListener iterationListener)
    Unregister IterationListener
    Parameters:
      `iterationListener` - `LoopIterationListener`

  - ### triggerEndOfLoop

    void triggerEndOfLoop()
    Trigger end of loop condition on controller (used by Start Next Loop feature)