Interface ThroughputLimitConfig
- All Superinterfaces:
Prototype.Api,Prototype.Factory<ThroughputLimit>
- All Known Implementing Classes:
ThroughputLimitConfig.BuilderBase.ThroughputLimitConfigImpl
Configuration of
ThroughputLimit.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classFluent API builder forThroughputLimit.static classThroughputLimitConfig.BuilderBase<BUILDER extends ThroughputLimitConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends ThroughputLimitConfig> Fluent API builder base forThroughputLimitConfig. -
Method Summary
Modifier and TypeMethodDescriptionintamount()Number of operations to allow during the relevant time window.builder()Create a new fluent API builder to customize configuration.builder(ThroughputLimitConfig instance) Create a new fluent API builder from an existing instance.clock()A clock that supplies nanosecond time.static ThroughputLimitConfigcreate()Create a new instance with default values.static ThroughputLimitConfigDeprecated.static ThroughputLimitConfigCreate a new instance from configuration.duration()Duration of the time window over which operations will be counted.booleanWhether to collect metrics for the throughput limit implementation.booleanfair()Whether theSemaphoreshould beSemaphore.isFair().name()Name of this instance.intHow many requests can be enqueued waiting for a permit.How long to wait for a permit when enqueued.The rate limiting algorithm to apply.Explicitly configured semaphore.Methods inherited from interface io.helidon.builder.api.Prototype.Factory
build
-
Method Details
-
builder
Create a new fluent API builder to customize configuration.- Returns:
- a new builder
-
builder
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
Create a new instance from configuration.- Parameters:
config- used to configure the new instance- Returns:
- a new instance configured from configuration
-
create
Deprecated.Create a new instance from configuration.- Parameters:
config- used to configure the new instance- Returns:
- a new instance configured from configuration
-
create
Create a new instance with default values.- Returns:
- a new instance
-
rateLimitingAlgorithm
RateLimitingAlgorithmType rateLimitingAlgorithm()The rate limiting algorithm to apply. Rate limiting algorithm is by defaultRateLimitingAlgorithmType.TOKEN_BUCKET.- Returns:
- the rate limiting algorithm to be applied
-
amount
int amount()Number of operations to allow during the relevant time window. Defaults to 0. When set to0, we switch to unlimited.- Returns:
- number of permits
-
duration
Duration duration()Duration of the time window over which operations will be counted. Defaults to "PT1S"- Returns:
- duration of the time window
-
fair
boolean fair()- 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 useSemaphore.getQueueLength()in theThroughputLimitimplementation. 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
Explicitly configured semaphore. Note that if this is set, all other configuration is ignored.- Returns:
- semaphore instance
-
clock
A clock that supplies nanosecond time.- Returns:
- supplier of current nanoseconds, defaults to
System.nanoTime()
-
enableMetrics
boolean enableMetrics()Whether to collect metrics for the throughput limit implementation.- Returns:
- metrics flag
-
create(io.helidon.config.Config)