Class ThroughputLimitConfig.BuilderBase.ThroughputLimitConfigImpl
java.lang.Object
io.helidon.common.concurrency.limits.ThroughputLimitConfig.BuilderBase.ThroughputLimitConfigImpl
- All Implemented Interfaces:
Prototype.Api,Prototype.Factory<ThroughputLimit>,ThroughputLimitConfig,Supplier<ThroughputLimit>
- Enclosing class:
ThroughputLimitConfig.BuilderBase<BUILDER extends ThroughputLimitConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends ThroughputLimitConfig>
protected static class ThroughputLimitConfig.BuilderBase.ThroughputLimitConfigImpl
extends Object
implements ThroughputLimitConfig, Supplier<ThroughputLimit>
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.ThroughputLimitConfig
ThroughputLimitConfig.Builder, ThroughputLimitConfig.BuilderBase<BUILDER extends ThroughputLimitConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends ThroughputLimitConfig> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedThroughputLimitConfigImpl(ThroughputLimitConfig.BuilderBase<?, ?> builder) Create an instance providing a builder. -
Method Summary
Modifier and TypeMethodDescriptionintamount()Number of operations to allow during the relevant time window.build()Create a new instance of the runtime type from this config object.clock()A clock that supplies nanosecond time.duration()Duration of the time window over which operations will be counted.booleanWhether to collect metrics for the throughput limit implementation.booleanbooleanfair()Whether theSemaphoreshould beSemaphore.isFair().get()inthashCode()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.toString()
-
Constructor Details
-
ThroughputLimitConfigImpl
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<ThroughputLimit>- Returns:
- new configured runtime instance
-
get
- Specified by:
getin interfaceSupplier<ThroughputLimit>
-
rateLimitingAlgorithm
Description copied from interface:ThroughputLimitConfigThe rate limiting algorithm to apply. Rate limiting algorithm is by defaultRateLimitingAlgorithmType.TOKEN_BUCKET.- Specified by:
rateLimitingAlgorithmin interfaceThroughputLimitConfig- Returns:
- the rate limiting algorithm to be applied
-
amount
public int amount()Description copied from interface:ThroughputLimitConfigNumber of operations to allow during the relevant time window. Defaults to 0. When set to0, we switch to unlimited.- Specified by:
amountin interfaceThroughputLimitConfig- Returns:
- number of permits
-
duration
Description copied from interface:ThroughputLimitConfigDuration of the time window over which operations will be counted. Defaults to "PT1S"- Specified by:
durationin interfaceThroughputLimitConfig- Returns:
- duration of the time window
-
fair
public boolean fair()Description copied from interface:ThroughputLimitConfig- Specified by:
fairin interfaceThroughputLimitConfig- Returns:
- whether this should be a fair semaphore
-
queueLength
public int queueLength()Description copied from interface:ThroughputLimitConfigHow 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.- Specified by:
queueLengthin interfaceThroughputLimitConfig- Returns:
- number of requests to enqueue
-
queueTimeout
Description copied from interface:ThroughputLimitConfigHow long to wait for a permit when enqueued. Defaults to "PT1S"- Specified by:
queueTimeoutin interfaceThroughputLimitConfig- Returns:
- duration of the timeout
-
name
Description copied from interface:ThroughputLimitConfigName of this instance.- Specified by:
namein interfaceThroughputLimitConfig- Returns:
- name of the instance
-
semaphore
Description copied from interface:ThroughputLimitConfigExplicitly configured semaphore. Note that if this is set, all other configuration is ignored.- Specified by:
semaphorein interfaceThroughputLimitConfig- Returns:
- semaphore instance
-
clock
Description copied from interface:ThroughputLimitConfigA clock that supplies nanosecond time.- Specified by:
clockin interfaceThroughputLimitConfig- Returns:
- supplier of current nanoseconds, defaults to
System.nanoTime()
-
enableMetrics
public boolean enableMetrics()Description copied from interface:ThroughputLimitConfigWhether to collect metrics for the throughput limit implementation.- Specified by:
enableMetricsin interfaceThroughputLimitConfig- Returns:
- metrics flag
-
toString
-
equals
-
hashCode
public int hashCode()
-