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

Package org.apache.jmeter.timers

# Class TimerService

java.lang.Object
org.apache.jmeter.timers.TimerService

public class TimerService extends Object
Manages logic related to timers and pauses

Since:
  3.2

- ## Method Summary

  Modifier and Type
  Method
  Description
  `long`
  `adjustDelay(long initialDelay)`
  Adjust delay so that initialDelay does not exceed end of test
  `long`
  `adjustDelay(long initialDelay, boolean runTillEnd)`
  Adjust delay so that initialDelay does not exceed end of test
  If `runTillEnd` is `false` the delay will be shortened to `-1` if the delay would be longer than the remaining run time.
  `long`
  `adjustDelay(long initialDelay, long endTime)`
  Adjust delay so that initialDelay does not exceed end of test
  `long`
  `adjustDelay(long initialDelay, long endTime, boolean runTillEnd)`
  Adjust delay so that initialDelay does not exceed end of test
  If `runTillEnd` is `false` the delay will be shortened to `-1` if the delay would be longer than the remaining run time.
  `static TimerService`
  `getInstance()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getInstance

    public static TimerService getInstance()
    Returns:
      ScriptEngineManager singleton

  - ### adjustDelay

    public long adjustDelay(long initialDelay)
    Adjust delay so that initialDelay does not exceed end of test
    Parameters:
      `initialDelay` - initial delay in milliseconds
    Returns:
      initialDelay or adjusted delay

  - ### adjustDelay

    public long adjustDelay(long initialDelay, boolean runTillEnd)
    Adjust delay so that initialDelay does not exceed end of test
    If `runTillEnd` is `false` the delay will be shortened to `-1` if the delay would be longer than the remaining run time.
    Parameters:
      `initialDelay` - initial delay in milliseconds
      `runTillEnd` - adjust delay to match the scheduled end
    Returns:
      initialDelay or adjusted delay

  - ### adjustDelay

    public long adjustDelay(long initialDelay, long endTime)
    Adjust delay so that initialDelay does not exceed end of test
    Parameters:
      `initialDelay` - initial delay in milliseconds
      `endTime` - End time of JMeterThread
    Returns:
      initialDelay or a shortened delay if delay is longer than the test is scheduled

  - ### adjustDelay

    public long adjustDelay(long initialDelay, long endTime, boolean runTillEnd)
    Adjust delay so that initialDelay does not exceed end of test
    If `runTillEnd` is `false` the delay will be shortened to `-1` if the delay would be longer than the remaining run time.
    Parameters:
      `initialDelay` - initial delay in milliseconds
      `endTime` - End time of JMeterThread
      `runTillEnd` - adjust delay to match the scheduled end
    Returns:
      initialDelay or a shortened delay if delay is longer than the test is scheduled