Interface AimdLimitConfig
- All Superinterfaces:
Prototype.Api
,Prototype.Factory<AimdLimit>
- All Known Implementing Classes:
AimdLimitConfig.BuilderBase.AimdLimitConfigImpl
Configuration of
AimdLimit
.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
Fluent API builder forAimdLimit
.static class
AimdLimitConfig.BuilderBase<BUILDER extends AimdLimitConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends AimdLimitConfig> Fluent API builder base forAimdLimit
. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Backoff ratio to use for the algorithm.static AimdLimitConfig.Builder
builder()
Create a new fluent API builder to customize configuration.static AimdLimitConfig.Builder
builder
(AimdLimitConfig instance) Create a new fluent API builder from an existing instance.clock()
A clock that supplies nanosecond time.static AimdLimitConfig
create()
Create a new instance with default values.static AimdLimitConfig
Create a new instance from configuration.boolean
Whether to collect metrics for the AIMD implementation.boolean
fair()
Whether theSemaphore
should beSemaphore.isFair()
.int
Initial limit.int
maxLimit()
Maximal limit.int
minLimit()
Minimal limit.name()
Name of this instance.int
How many requests can be enqueued waiting for a permit after the max limit is reached.How long to wait for a permit when enqueued.timeout()
Timeout that when exceeded is the same as if the task failed.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
Create a new instance with default values.- Returns:
- a new instance
-
backoffRatio
double backoffRatio()Backoff ratio to use for the algorithm. The value must be within [0.5, 1.0).- Returns:
- backoff ratio
-
initialLimit
int initialLimit()Initial limit. The value must be within [minLimit()
,maxLimit()
].- Returns:
- initial limit
-
maxLimit
int maxLimit()Maximal limit. The value must be same or higher thanminLimit()
.- Returns:
- maximal limit
-
minLimit
int minLimit()Minimal limit. The value must be same or lower thanmaxLimit()
.- Returns:
- minimal limit
-
timeout
Duration timeout()Timeout that when exceeded is the same as if the task failed.- Returns:
- task timeout, defaults to 5 seconds
-
clock
A clock that supplies nanosecond time.- Returns:
- supplier of current nanoseconds, defaults to
System.nanoTime()
-
name
String name()Name of this instance.- Returns:
- name of the instance
-
queueLength
int queueLength()How many requests can be enqueued waiting for a permit after the max limit is reached. Note that this may not be an exact behavior due to concurrent invocations. We useSemaphore.getQueueLength()
in theAimdLimit
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
-
fair
boolean fair()- Returns:
- whether this should be a fair semaphore
-
enableMetrics
boolean enableMetrics()Whether to collect metrics for the AIMD implementation.- Returns:
- metrics flag
-