Package com.xceptance.xlt.api.engine

# Class AbstractCustomSampler

java.lang.Object
com.xceptance.xlt.api.engine.AbstractCustomSampler

public abstract class AbstractCustomSampler extends Object
The `AbstractCustomSampler` provides the common functionality of custom samplers.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractCustomSampler()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract double`
  `execute()`
  Execute the sampler.
  `long`
  `getInterval()`
  Get the execution interval.
  `String`
  `getName()`
  Get the sampler name.
  `Properties`
  `getProperties()`
  Get properties of this sampler.
  `void`
  `initialize()`
  Executed once at the start of the sampler.
  `void`
  `setInterval(long interval)`
  Set the execution interval.
  `void`
  `setInterval(String interval)`
  Set the execution interval.
  `void`
  `setName(String name)`
  Set the sampler name.
  `void`
  `setProperties(Properties properties)`
  Set properties of this sampler.
  `void`
  `shutdown()`
  Executed once when the sampler get shut down.

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

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

- ## Constructor Details

  - ### AbstractCustomSampler

    public AbstractCustomSampler()

- ## Method Details

  - ### initialize

    public void initialize()
    Executed once at the start of the sampler.

  - ### execute

    public abstract double execute()
    Execute the sampler.

  - ### shutdown

    public void shutdown()
    Executed once when the sampler get shut down.

  - ### setInterval

    public void setInterval(long interval)
    Set the execution interval.
    Parameters:
      `interval` - positive interval value in milliseconds (0 or higher)
    See Also:
      - `setInterval(String)`

  - ### setInterval

    public void setInterval(String interval)
    Set the execution interval. If using the convenience approach to set time periods (for example with "3h 5m 7s") in XLT the resulting number of milliseconds is computed internally.
    Parameters:
      `interval` - the milliseconds as in `setInterval(long)` or a time period as with the convenient way

  - ### getInterval

    public long getInterval()
    Get the execution interval.
    Returns:
      the execution interval

  - ### setName

    public void setName(String name)
    Set the sampler name. Setting the name after the sampler has started will have no effect.
    Parameters:
      `name` - sampler name

  - ### getName

    public String getName()
    Get the sampler name.
    Returns:
      sampler name

  - ### getProperties

    public Properties getProperties()
    Get properties of this sampler.
    Returns:
      all properties

  - ### setProperties

    public void setProperties(Properties properties)
    Set properties of this sampler.
    Parameters:
      `properties` - properties for that sampler