All Superinterfaces:
Prototype.Api, Prototype.Factory<FixedLimit>
All Known Implementing Classes:
FixedLimitConfig.BuilderBase.FixedLimitConfigImpl

public interface FixedLimitConfig extends Prototype.Api
Configuration of FixedLimit.
See Also:
  • Method Details

    • builder

      static FixedLimitConfig.Builder builder()
      Create a new fluent API builder to customize configuration.
      Returns:
      a new builder
    • builder

      static FixedLimitConfig.Builder builder(FixedLimitConfig instance)
      Create a new fluent API builder from an existing instance.
      Parameters:
      instance - an existing instance used as a base for the builder
      Returns:
      a builder based on an instance
    • create

      static FixedLimitConfig create(Config config)
      Create a new instance from configuration.
      Parameters:
      config - used to configure the new instance
      Returns:
      a new instance configured from configuration
    • create

      static FixedLimitConfig create()
      Create a new instance with default values.
      Returns:
      a new instance
    • permits

      int permits()
      Number of permit to allow. Defaults to 0. When set to 0, we switch to unlimited.
      Returns:
      number of permits
    • fair

      boolean fair()
      Whether the Semaphore should be Semaphore.isFair(). Defaults to false.
      Returns:
      whether this should be a fair semaphore
    • queueLength

      int queueLength()
      How many requests can be enqueued waiting for a permit. Note that this may not be an exact behavior due to concurrent invocations. We use Semaphore.getQueueLength() in the FixedLimit implementation. Default value is 0. If set to {code 0}, there is no queueing.
      Returns:
      number of requests to enqueue
    • queueTimeout

      Duration queueTimeout()
      How long to wait for a permit when enqueued. Defaults to "PT1S"
      Returns:
      duration of the timeout
    • name

      String name()
      Name of this instance.
      Returns:
      name of the instance
    • semaphore

      Optional<Semaphore> semaphore()
      Explicitly configured semaphore. Note that if this is set, all other configuration is ignored.
      Returns:
      semaphore instance