Interface AimdLimitConfig
- All Superinterfaces:
Prototype.Api, Prototype.Factory<AimdLimit>
- All Known Implementing Classes:
AimdLimitConfig.BuilderBase.AimdLimitConfigImpl
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classFluent API builder forAimdLimit.static classAimdLimitConfig.BuilderBase<BUILDER extends AimdLimitConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends AimdLimitConfig>Fluent API builder base forAimdLimitConfig. -
Method Summary
Modifier and TypeMethodDescriptiondoubleBackoff ratio to use for the algorithm.static AimdLimitConfig.Builderbuilder()Create a new fluent API builder to customize configuration.static AimdLimitConfig.Builderbuilder(AimdLimitConfig instance) Create a new fluent API builder from an existing instance.clock()A clock that supplies nanosecond time.static AimdLimitConfigcreate()Create a new instance with default values.static AimdLimitConfigCreate a new instance from configuration.booleanWhether to collect metrics for the AIMD implementation.booleanfair()Whether theSemaphoreshould beSemaphore.isFair().intInitial limit.intmaxLimit()Maximal limit.intminLimit()Minimal limit.name()Name of this instance.intHow 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 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
-
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
-
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 theAimdLimitimplementation. Default value is 0. If set to0, there is no queueing.- Returns:
- number of requests to enqueue
-
queueTimeout
-
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
-