InterleaveControl (Apache JMeter dist API)
Description: declaration: package: org.apache.jmeter.control, class: InterleaveControl

Package org.apache.jmeter.control

# Class InterleaveControl

java.lang.Object
org.apache.jmeter.testelement.AbstractTestElement
org.apache.jmeter.control.GenericController
org.apache.jmeter.control.InterleaveControl

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `Controller`, `Searchable`, `org.apache.jmeter.testelement.TestElement`, `TestCompilerHelper`

Direct Known Subclasses:
  `RandomController`

public class InterleaveControl extends GenericController implements Serializable
Alternate among each of the children controllers or samplers for each loop iteration

See Also:
  - Serialized Form

- ## Nested Class Summary

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

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

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `IGNORE_SUB_CONTROLLERS`
  `static final int`
  `USE_SUB_CONTROLLERS`

  ### Fields inherited from class org.apache.jmeter.control.GenericController

  `current, subControllersAndSamplers`

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

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

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InterleaveControl()`
  Constructor for the InterleaveControl object

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `currentReturnedNull(Controller c)`
  If the controller is done, remove it from the list, otherwise increment to next entry in list.
  `boolean`
  `getInterleaveAccrossThreads()`
  `int`
  `getStyle()`
  `protected void`
  `incrementCurrent()`
  Increments the current pointer; called by currentReturnedNull to move the controller on to its next child.
  `void`
  `initialize()`
  Called to initialize a controller at the beginning of a test iteration.
  `protected boolean`
  `isSkipNext()`
  `Sampler`
  `next()`
  Determines the next sampler to be processed.
  `protected Sampler`
  `nextIsAController(Controller controller)`
  Called by `GenericController.next()` if the element is a Controller, and returns the next sampler from the controller.
  `protected Sampler`
  `nextIsASampler(Sampler element)`
  Increment the current pointer and return the element.
  `protected Sampler`
  `nextIsNull()`
  If the current is null, reset and continue searching.
  `void`
  `reInitialize()`
  Resets the controller (called after execution of last child of controller): resetCurrent() (i.e.
  `protected void`
  `setCurrentElement(org.apache.jmeter.testelement.TestElement currentElement)`
  Empty implementation - does nothing.
  `void`
  `setInterleaveAccrossThreads(boolean accrossThreads)`
  `protected void`
  `setSkipNext(boolean skipNext)`
  `void`
  `setStyle(int style)`

  ### Methods inherited from class org.apache.jmeter.control.GenericController

  `addIterationListener, addTestElement, addTestElementOnce, fireIterationStart, fireIterEvents, getCurrentElement, getIterCount, getProps, getSchema, getSubControllers, incrementIterCount, initializeSubControllers, isDone, isFirst, readResolve, removeCurrentElement, removeIterationListener, resetCurrent, resetIterCount, setDone, setFirst, triggerEndOfLoop`

  ### Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

  `addPropertiesValues, addProperty, addProperty, canRemove, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getPropertyOrNull, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, 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, 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, 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`

- ## Field Details

  - ### IGNORE_SUB_CONTROLLERS

    public static final int IGNORE_SUB_CONTROLLERS
    See Also:
      - Constant Field Values

  - ### USE_SUB_CONTROLLERS

    public static final int USE_SUB_CONTROLLERS
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### InterleaveControl

    public InterleaveControl()
    Constructor for the InterleaveControl object

- ## Method Details

  - ### reInitialize

    public void reInitialize()
    Resets the controller (called after execution of last child of controller):
    - resetCurrent() (i.e. current=0)
    - increment iteration count
    - sets first=true
    - recoverRunningVersion() to set the controller back to the initial state
    Overrides:
      `reInitialize` in class `GenericController`

  - ### setStyle

    public void setStyle(int style)

  - ### getStyle

    public int getStyle()

  - ### setInterleaveAccrossThreads

    public void setInterleaveAccrossThreads(boolean accrossThreads)

  - ### getInterleaveAccrossThreads

    public boolean getInterleaveAccrossThreads()

  - ### next

    public Sampler next()

    Determines the next sampler to be processed.

    If `GenericController.isDone()` is `true`, returns null.

    Gets the list element using current pointer. If this is `null`, calls `GenericController.nextIsNull()`.

    If the list element is a `Sampler`, calls `GenericController.nextIsASampler(Sampler)`, otherwise calls `GenericController.nextIsAController(Controller)`

    If any of the called methods throws `NextIsNullException`, returns `null`, otherwise the value obtained above is returned.

    Specified by:
      `next` in interface `Controller`
    Overrides:
      `next` in class `GenericController`
    Returns:
      the next sampler or `null`

  - ### nextIsAController

    protected Sampler nextIsAController(Controller controller) throws NextIsNullException
    Called by `GenericController.next()` if the element is a Controller, and returns the next sampler from the controller. If this is `null`, then updates the current pointer and makes recursive call to `GenericController.next()`.
    Overrides:
      `nextIsAController` in class `GenericController`
    Parameters:
      `controller` - the current next element
    Returns:
      the next sampler
    Throws:
      `NextIsNullException` - when the end of the list has already been reached

  - ### nextIsASampler

    protected Sampler nextIsASampler(Sampler element) throws NextIsNullException
    Increment the current pointer and return the element. Called by `GenericController.next()` if the element is a sampler. (May be overridden by sub-classes).
    Overrides:
      `nextIsASampler` in class `GenericController`
    Parameters:
      `element` - the current next element
    Returns:
      input element
    Throws:
      `NextIsNullException` - when the end of the list has already been reached

  - ### nextIsNull

    protected Sampler nextIsNull()
    If the current is null, reset and continue searching. The searchStart attribute will break us off when we start a repeat.

    Called by `GenericController.next()` when `GenericController.getCurrentElement()` returns `null`. Reinitialises the controller.

    Overrides:
      `nextIsNull` in class `GenericController`
    Returns:
      null (always, for this class)

  - ### setCurrentElement

    protected void setCurrentElement(org.apache.jmeter.testelement.TestElement currentElement) throws NextIsNullException
    Empty implementation - does nothing.
    Overrides:
      `setCurrentElement` in class `GenericController`
    Parameters:
      `currentElement` - the current element
    Throws:
      `NextIsNullException` - when the list has been completed already

  - ### currentReturnedNull

    protected void currentReturnedNull(Controller c)
    If the controller is done, remove it from the list, otherwise increment to next entry in list.
    Overrides:
      `currentReturnedNull` in class `GenericController`
    Parameters:
      `c` - controller

  - ### isSkipNext

    protected boolean isSkipNext()

  - ### setSkipNext

    protected void setSkipNext(boolean skipNext)

  - ### incrementCurrent

    protected void incrementCurrent()
    Increments the current pointer; called by currentReturnedNull to move the controller on to its next child.
    Overrides:
      `incrementCurrent` in class `GenericController`

  - ### 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`
    Overrides:
      `initialize` in class `GenericController`
    See Also:
      - `GenericController.initialize()`