org.apache.jmeter.control

## Interface Controller

- All Superinterfaces:
    Cloneable, 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 TestElement

  This interface is used by JMeterThread in the following manner:

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

- - ### Field Summary

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

      `COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and 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, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removed, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse`

- - ### Method Detail

    - #### 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)

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