Class Delay


Author:
jamesdbloom
  • Constructor Details

  • Method Details

    • milliseconds

      public static Delay milliseconds(long value)
    • seconds

      public static Delay seconds(long value)
    • minutes

      public static Delay minutes(long value)
    • delay

      public static Delay delay(TimeUnit timeUnit, long value)
    • uniform

      public static Delay uniform(TimeUnit timeUnit, long min, long max)
    • logNormal

      public static Delay logNormal(TimeUnit timeUnit, long median, long p99)
    • gaussian

      public static Delay gaussian(TimeUnit timeUnit, long mean, long stdDev)
    • template

      public static Delay template(HttpTemplate.TemplateType templateType, String template)
      Creates an opt-in delay whose duration in milliseconds is computed by rendering the supplied template against the incoming request (the same request context exposed to response templates, e.g. request.body, request.headers). The rendered output is parsed as a millisecond value, so e.g. larger request payloads can respond more slowly. When the template renders to a non-numeric or blank value the delay falls back to the static value/timeUnit pair (which defaults to zero). Only HttpTemplate.TemplateType.VELOCITY and HttpTemplate.TemplateType.MUSTACHE are supported.
    • getTimeUnit

      public TimeUnit getTimeUnit()
    • getValue

      public long getValue()
    • getDistribution

      public DelayDistribution getDistribution()
    • getTemplate

      public String getTemplate()
    • getTemplateType

      public HttpTemplate.TemplateType getTemplateType()
    • hasTemplate

      public boolean hasTemplate()
      Returns:
      true when this delay computes its duration from a request template (see template(HttpTemplate.TemplateType, String)).
    • sampleValueMillis

      public long sampleValueMillis()
    • applyDelay

      public void applyDelay()