Class FixedLimitConfig.BuilderBase<BUILDER extends FixedLimitConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends FixedLimitConfig>
java.lang.Object
io.helidon.common.concurrency.limits.FixedLimitConfig.BuilderBase<BUILDER,PROTOTYPE>
- Type Parameters:
BUILDER
- type of the builder extending this abstract builderPROTOTYPE
- type of the prototype interface that would be built byPrototype.Builder.buildPrototype()
- All Implemented Interfaces:
Prototype.Builder<BUILDER,
,PROTOTYPE> Prototype.ConfiguredBuilder<BUILDER,
PROTOTYPE>
- Direct Known Subclasses:
FixedLimitConfig.Builder
- Enclosing interface:
FixedLimitConfig
public abstract static class FixedLimitConfig.BuilderBase<BUILDER extends FixedLimitConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends FixedLimitConfig>
extends Object
implements Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for
FixedLimit
.-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Generated implementation of the prototype, can be extended by descendant prototype implementations. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionClear existing value of this property.config()
If this instance was configured, this would be the config instance used.Update builder from configuration (node of this type).boolean
fair()
Whether theSemaphore
should beSemaphore.isFair()
.fair
(boolean fair) Whether theSemaphore
should beSemaphore.isFair()
.from
(FixedLimitConfig prototype) Update this builder from an existing prototype instance.from
(FixedLimitConfig.BuilderBase<?, ?> builder) Update this builder from an existing prototype builder instance.name()
Name of this instance.Name of this instance.int
permits()
Number of permit to allow.permits
(int permits) Number of permit to allow.protected void
Handles providers and decorators.int
How many requests can be enqueued waiting for a permit.queueLength
(int queueLength) How many requests can be enqueued waiting for a permit.How long to wait for a permit when enqueued.queueTimeout
(Duration queueTimeout) How long to wait for a permit when enqueued.Explicitly configured semaphore.Explicitly configured semaphore.toString()
protected void
Validates required properties.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.helidon.builder.api.Prototype.Builder
buildPrototype, self
Methods inherited from interface io.helidon.builder.api.Prototype.ConfiguredBuilder
discoverService, discoverServices
-
Constructor Details
-
BuilderBase
protected BuilderBase()Protected to support extensibility.
-
-
Method Details
-
from
Update this builder from an existing prototype instance. This method disables automatic service discovery.- Parameters:
prototype
- existing prototype to update this builder from- Returns:
- updated builder instance
-
from
Update this builder from an existing prototype builder instance.- Parameters:
builder
- existing builder prototype to update this builder from- Returns:
- updated builder instance
-
config
Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.- Specified by:
config
in interfacePrototype.ConfiguredBuilder<BUILDER extends FixedLimitConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends FixedLimitConfig> - Parameters:
config
- configuration instance used to obtain values to update this builder- Returns:
- updated builder instance
-
permits
Number of permit to allow. Defaults to 0. When set to0
, we switch to unlimited.- Parameters:
permits
- number of permits- Returns:
- updated builder instance
- See Also:
-
fair
- Parameters:
fair
- whether this should be a fair semaphore- Returns:
- updated builder instance
- See Also:
-
queueLength
How 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 theFixedLimit
implementation. Default value is 0. If set to {code 0}, there is no queueing.- Parameters:
queueLength
- number of requests to enqueue- Returns:
- updated builder instance
- See Also:
-
queueTimeout
How long to wait for a permit when enqueued. Defaults to "PT1S"- Parameters:
queueTimeout
- duration of the timeout- Returns:
- updated builder instance
- See Also:
-
name
Name of this instance.- Parameters:
name
- name of the instance- Returns:
- updated builder instance
- See Also:
-
clearSemaphore
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
semaphore
Explicitly configured semaphore. Note that if this is set, all other configuration is ignored.- Parameters:
semaphore
- semaphore instance- Returns:
- updated builder instance
- See Also:
-
permits
public int permits()Number of permit to allow. Defaults to 0. When set to0
, we switch to unlimited.- Returns:
- the permits
-
fair
public boolean fair()- Returns:
- the fair
-
queueLength
public int queueLength()How 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 theFixedLimit
implementation. Default value is 0. If set to {code 0}, there is no queueing.- Returns:
- the queue length
-
queueTimeout
How long to wait for a permit when enqueued. Defaults to "PT1S"- Returns:
- the queue timeout
-
name
Name of this instance.- Returns:
- the name
-
semaphore
Explicitly configured semaphore. Note that if this is set, all other configuration is ignored.- Returns:
- the semaphore
-
config
If this instance was configured, this would be the config instance used.- Returns:
- config node used to configure this builder, or empty if not configured
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties.
-