Class AimdLimitConfig.BuilderBase.AimdLimitConfigImpl
java.lang.Object
io.helidon.common.concurrency.limits.AimdLimitConfig.BuilderBase.AimdLimitConfigImpl
- All Implemented Interfaces:
Prototype.Api,Prototype.Factory<AimdLimit>,AimdLimitConfig,Supplier<AimdLimit>
- Enclosing class:
AimdLimitConfig.BuilderBase<BUILDER extends AimdLimitConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends AimdLimitConfig>
protected static class AimdLimitConfig.BuilderBase.AimdLimitConfigImpl
extends Object
implements AimdLimitConfig, Supplier<AimdLimit>
Generated implementation of the prototype, can be extended by descendant prototype implementations.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.helidon.common.concurrency.limits.AimdLimitConfig
AimdLimitConfig.Builder, AimdLimitConfig.BuilderBase<BUILDER extends AimdLimitConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends AimdLimitConfig> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAimdLimitConfigImpl(AimdLimitConfig.BuilderBase<?, ?> builder) Create an instance providing a builder. -
Method Summary
Modifier and TypeMethodDescriptiondoubleBackoff ratio to use for the algorithm.build()Create a new instance of the runtime type from this config object.clock()A clock that supplies nanosecond time.booleanWhether to collect metrics for the AIMD implementation.booleanbooleanfair()Whether theSemaphoreshould beSemaphore.isFair().get()inthashCode()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.toString()
-
Constructor Details
-
AimdLimitConfigImpl
Create an instance providing a builder.- Parameters:
builder- extending builder base of this prototype
-
-
Method Details
-
build
Description copied from interface:Prototype.FactoryCreate a new instance of the runtime type from this config object.- Specified by:
buildin interfacePrototype.Factory<AimdLimit>- Returns:
- new configured runtime instance
-
get
-
backoffRatio
public double backoffRatio()Description copied from interface:AimdLimitConfigBackoff ratio to use for the algorithm. The value must be within [0.5, 1.0).- Specified by:
backoffRatioin interfaceAimdLimitConfig- Returns:
- backoff ratio
-
initialLimit
public int initialLimit()Description copied from interface:AimdLimitConfigInitial limit. The value must be within [AimdLimitConfig.minLimit(),AimdLimitConfig.maxLimit()].- Specified by:
initialLimitin interfaceAimdLimitConfig- Returns:
- initial limit
-
maxLimit
public int maxLimit()Description copied from interface:AimdLimitConfigMaximal limit. The value must be same or higher thanAimdLimitConfig.minLimit().- Specified by:
maxLimitin interfaceAimdLimitConfig- Returns:
- maximal limit
-
minLimit
public int minLimit()Description copied from interface:AimdLimitConfigMinimal limit. The value must be same or lower thanAimdLimitConfig.maxLimit().- Specified by:
minLimitin interfaceAimdLimitConfig- Returns:
- minimal limit
-
timeout
Description copied from interface:AimdLimitConfigTimeout that when exceeded is the same as if the task failed.- Specified by:
timeoutin interfaceAimdLimitConfig- Returns:
- task timeout, defaults to 5 seconds
-
clock
Description copied from interface:AimdLimitConfigA clock that supplies nanosecond time.- Specified by:
clockin interfaceAimdLimitConfig- Returns:
- supplier of current nanoseconds, defaults to
System.nanoTime()
-
name
Description copied from interface:AimdLimitConfigName of this instance.- Specified by:
namein interfaceAimdLimitConfig- Returns:
- name of the instance
-
queueLength
public int queueLength()Description copied from interface:AimdLimitConfigHow 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 to {code 0}, there is no queueing.- Specified by:
queueLengthin interfaceAimdLimitConfig- Returns:
- number of requests to enqueue
-
queueTimeout
Description copied from interface:AimdLimitConfigHow long to wait for a permit when enqueued. Defaults to "PT1S"- Specified by:
queueTimeoutin interfaceAimdLimitConfig- Returns:
- duration of the timeout
-
fair
public boolean fair()Description copied from interface:AimdLimitConfig- Specified by:
fairin interfaceAimdLimitConfig- Returns:
- whether this should be a fair semaphore
-
enableMetrics
public boolean enableMetrics()Description copied from interface:AimdLimitConfigWhether to collect metrics for the AIMD implementation.- Specified by:
enableMetricsin interfaceAimdLimitConfig- Returns:
- metrics flag
-
toString
-
equals
-
hashCode
public int hashCode()
-