Class FixedLimitConfig.BuilderBase.FixedLimitConfigImpl
java.lang.Object
io.helidon.common.concurrency.limits.FixedLimitConfig.BuilderBase.FixedLimitConfigImpl
- All Implemented Interfaces:
Prototype.Api, Prototype.Factory<FixedLimit>, FixedLimitConfig, Supplier<FixedLimit>
- Enclosing class:
FixedLimitConfig.BuilderBase<BUILDER extends FixedLimitConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends FixedLimitConfig>
protected static class FixedLimitConfig.BuilderBase.FixedLimitConfigImpl
extends Object
implements FixedLimitConfig, Supplier<FixedLimit>
Generated implementation of the prototype, can be extended by descendant prototype implementations.
-
Nested Class Summary
Nested classes/interfaces inherited from interface FixedLimitConfig
FixedLimitConfig.Builder, FixedLimitConfig.BuilderBase<BUILDER, PROTOTYPE>Modifier and TypeInterfaceDescriptionstatic classFluent API builder forFixedLimit.static classFixedLimitConfig.BuilderBase<BUILDER extends FixedLimitConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends FixedLimitConfig>Fluent API builder base forFixedLimitConfig. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFixedLimitConfigImpl(FixedLimitConfig.BuilderBase<?, ?> builder) Create an instance providing a builder. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Create a new runtime instance from this prototype.clock()A clock that supplies nanosecond time.booleanWhether to collect metrics for the fixed limit implementation.booleanbooleanfair()Whether theSemaphoreshould beSemaphore.isFair().get()inthashCode()name()Name of this instance.intpermits()Number of permits to allow.intHow many requests can be enqueued waiting for a permit.How long to wait for a permit when enqueued.Explicitly configured semaphore.toString()
-
Constructor Details
-
FixedLimitConfigImpl
Create an instance providing a builder.- Parameters:
builder- extending builder base of this prototype
-
-
Method Details
-
build
Create a new runtime instance from this prototype.- Specified by:
buildin interfacePrototype.Factory<FixedLimit>- Returns:
- new configured runtime instance
-
get
- Specified by:
getin interfaceSupplier<FixedLimit>
-
permits
public int permits()Description copied from interface:FixedLimitConfigNumber of permits to allow. Defaults to 0. When set to0, we switch to unlimited.- Specified by:
permitsin interfaceFixedLimitConfig- Returns:
- number of permits
-
fair
public boolean fair()Description copied from interface:FixedLimitConfig- Specified by:
fairin interfaceFixedLimitConfig- Returns:
- whether this should be a fair semaphore
-
queueLength
public int queueLength()Description copied from interface:FixedLimitConfigHow 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 theFixedLimitimplementation. Default value is 0. If set to0, there is no queueing.- Specified by:
queueLengthin interfaceFixedLimitConfig- Returns:
- number of requests to enqueue
-
queueTimeout
Description copied from interface:FixedLimitConfigHow long to wait for a permit when enqueued. Defaults to "PT1S"- Specified by:
queueTimeoutin interfaceFixedLimitConfig- Returns:
- duration of the timeout
-
name
Description copied from interface:FixedLimitConfigName of this instance.- Specified by:
namein interfaceFixedLimitConfig- Returns:
- name of the instance
-
semaphore
Description copied from interface:FixedLimitConfigExplicitly configured semaphore. Note that if this is set, all other configuration is ignored.- Specified by:
semaphorein interfaceFixedLimitConfig- Returns:
- semaphore instance
-
clock
Description copied from interface:FixedLimitConfigA clock that supplies nanosecond time.- Specified by:
clockin interfaceFixedLimitConfig- Returns:
- supplier of current nanoseconds, defaults to
System.nanoTime()
-
enableMetrics
public boolean enableMetrics()Description copied from interface:FixedLimitConfigWhether to collect metrics for the fixed limit implementation.- Specified by:
enableMetricsin interfaceFixedLimitConfig- Returns:
- metrics flag
-
toString
-
equals
-
hashCode
-