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
ConstructorsModifierConstructorDescriptionprotected
AimdLimitConfigImpl
(AimdLimitConfig.BuilderBase<?, ?> builder) Create an instance providing a builder. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Backoff 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.boolean
Whether to collect metrics for the AIMD implementation.boolean
boolean
fair()
Whether theSemaphore
should beSemaphore.isFair()
.get()
int
hashCode()
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.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.Factory
Create a new instance of the runtime type from this config object.- Specified by:
build
in interfacePrototype.Factory<AimdLimit>
- Returns:
- new configured runtime instance
-
get
-
backoffRatio
public double backoffRatio()Description copied from interface:AimdLimitConfig
Backoff ratio to use for the algorithm. The value must be within [0.5, 1.0).- Specified by:
backoffRatio
in interfaceAimdLimitConfig
- Returns:
- backoff ratio
-
initialLimit
public int initialLimit()Description copied from interface:AimdLimitConfig
Initial limit. The value must be within [AimdLimitConfig.minLimit()
,AimdLimitConfig.maxLimit()
].- Specified by:
initialLimit
in interfaceAimdLimitConfig
- Returns:
- initial limit
-
maxLimit
public int maxLimit()Description copied from interface:AimdLimitConfig
Maximal limit. The value must be same or higher thanAimdLimitConfig.minLimit()
.- Specified by:
maxLimit
in interfaceAimdLimitConfig
- Returns:
- maximal limit
-
minLimit
public int minLimit()Description copied from interface:AimdLimitConfig
Minimal limit. The value must be same or lower thanAimdLimitConfig.maxLimit()
.- Specified by:
minLimit
in interfaceAimdLimitConfig
- Returns:
- minimal limit
-
timeout
Description copied from interface:AimdLimitConfig
Timeout that when exceeded is the same as if the task failed.- Specified by:
timeout
in interfaceAimdLimitConfig
- Returns:
- task timeout, defaults to 5 seconds
-
clock
Description copied from interface:AimdLimitConfig
A clock that supplies nanosecond time.- Specified by:
clock
in interfaceAimdLimitConfig
- Returns:
- supplier of current nanoseconds, defaults to
System.nanoTime()
-
name
Description copied from interface:AimdLimitConfig
Name of this instance.- Specified by:
name
in interfaceAimdLimitConfig
- Returns:
- name of the instance
-
queueLength
public int queueLength()Description copied from interface:AimdLimitConfig
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.- Specified by:
queueLength
in interfaceAimdLimitConfig
- Returns:
- number of requests to enqueue
-
queueTimeout
Description copied from interface:AimdLimitConfig
How long to wait for a permit when enqueued. Defaults to "PT1S"- Specified by:
queueTimeout
in interfaceAimdLimitConfig
- Returns:
- duration of the timeout
-
fair
public boolean fair()Description copied from interface:AimdLimitConfig
- Specified by:
fair
in interfaceAimdLimitConfig
- Returns:
- whether this should be a fair semaphore
-
enableMetrics
public boolean enableMetrics()Description copied from interface:AimdLimitConfig
Whether to collect metrics for the AIMD implementation.- Specified by:
enableMetrics
in interfaceAimdLimitConfig
- Returns:
- metrics flag
-
toString
-
equals
-
hashCode
public int hashCode()
-