Package io.helidon.common.configurable
Class ThreadPoolConfig.BuilderBase<BUILDER extends ThreadPoolConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends ThreadPoolConfig>
java.lang.Object
io.helidon.common.configurable.ThreadPoolConfig.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:
ThreadPoolConfig.Builder
- Enclosing interface:
ThreadPoolConfig
public abstract static class ThreadPoolConfig.BuilderBase<BUILDER extends ThreadPoolConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends ThreadPoolConfig>
extends Object
implements Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for
ThreadPoolSupplier
.-
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.Clear 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).int
Core pool size of the thread pool executor.corePoolSize
(int corePoolSize) Core pool size of the thread pool executor.boolean
daemon()
Is daemon of the thread pool executor.daemon
(boolean daemon) Is daemon of the thread pool executor.from
(ThreadPoolConfig prototype) Update this builder from an existing prototype instance.from
(ThreadPoolConfig.BuilderBase<?, ?> builder) Update this builder from an existing prototype builder instance.int
The percentage of task submissions that should result in adding threads, expressed as a value from 1 to 100.growthRate
(int growthRate) The percentage of task submissions that should result in adding threads, expressed as a value from 1 to 100.int
The queue size above which pool growth will be considered if the pool is not fixed size.growthThreshold
(int growthThreshold) The queue size above which pool growth will be considered if the pool is not fixed size.Keep alive of the thread pool executor.Keep alive of the thread pool executor.int
Max pool size of the thread pool executor.maxPoolSize
(int maxPoolSize) Max pool size of the thread pool executor.name()
Name of this thread pool executor.Name of this thread pool executor.protected void
Handles providers and decorators.int
Queue capacity of the thread pool executor.queueCapacity
(int queueCapacity) Queue capacity of the thread pool executor.Rejection policy of the thread pool executor.rejectionHandler
(ThreadPool.RejectionHandler rejectionHandler) Rejection policy of the thread pool executor.boolean
Whether to prestart core threads in this thread pool executor.shouldPrestart
(boolean shouldPrestart) Whether to prestart core threads in this thread pool executor.Name prefix for threads in this thread pool executor.threadNamePrefix
(String threadNamePrefix) Name prefix for threads in this thread pool executor.toString()
protected void
Validates required properties.boolean
When configured totrue
, an unbounded virtual executor service (project Loom) will be used.virtualThreads
(boolean virtualThreads) When configured totrue
, an unbounded virtual executor service (project Loom) will be used.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 ThreadPoolConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends ThreadPoolConfig> - Parameters:
config
- configuration instance used to obtain values to update this builder- Returns:
- updated builder instance
-
virtualThreads
When configured totrue
, an unbounded virtual executor service (project Loom) will be used.If enabled, all other configuration options of this executor service are ignored!
- Parameters:
virtualThreads
- whether to use virtual threads or not, defaults tofalse
- Returns:
- updated builder instance
- See Also:
-
corePoolSize
Core pool size of the thread pool executor. Defaults to 10.- Parameters:
corePoolSize
- corePoolSize seeThreadPoolExecutor.getCorePoolSize()
- Returns:
- updated builder instance
- See Also:
-
maxPoolSize
Max pool size of the thread pool executor. Defaults to 50.- Parameters:
maxPoolSize
- maxPoolSize seeThreadPoolExecutor.getMaximumPoolSize()
- Returns:
- updated builder instance
- See Also:
-
keepAlive
Keep alive of the thread pool executor. Defaults to "PT3M".- Parameters:
keepAlive
- keep alive seeThreadPoolExecutor.getKeepAliveTime(java.util.concurrent.TimeUnit)
- Returns:
- updated builder instance
- See Also:
-
queueCapacity
Queue capacity of the thread pool executor. Defaults to 10000.- Parameters:
queueCapacity
- capacity of the queue backing the executor- Returns:
- updated builder instance
- See Also:
-
daemon
Is daemon of the thread pool executor. Defaults to true.- Parameters:
daemon
- whether the threads are daemon threads- Returns:
- updated builder instance
- See Also:
-
clearName
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
name
Name of this thread pool executor.- Parameters:
name
- the pool name- Returns:
- updated builder instance
- See Also:
-
growthThreshold
The queue size above which pool growth will be considered if the pool is not fixed size. Defaults to 1000.- Parameters:
growthThreshold
- the growth threshold- Returns:
- updated builder instance
- See Also:
-
growthRate
The percentage of task submissions that should result in adding threads, expressed as a value from 1 to 100. The rate applies only when all of the following are true:- the pool size is below the maximum, and
- there are no idle threads, and
- the number of tasks in the queue exceeds the
growthThreshold
Defaults to 0
- Parameters:
growthRate
- the growth rate- Returns:
- updated builder instance
- See Also:
-
rejectionHandler
Rejection policy of the thread pool executor.- Parameters:
rejectionHandler
- the rejection handler- Returns:
- updated builder instance
- See Also:
-
clearThreadNamePrefix
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
threadNamePrefix
Name prefix for threads in this thread pool executor. Defaults to "helidon-".- Parameters:
threadNamePrefix
- prefix of a thread name- Returns:
- updated builder instance
- See Also:
-
shouldPrestart
Whether to prestart core threads in this thread pool executor. Defaults to true.- Parameters:
shouldPrestart
- whether to prestart the threads- Returns:
- updated builder instance
- See Also:
-
virtualThreads
public boolean virtualThreads()When configured totrue
, an unbounded virtual executor service (project Loom) will be used.If enabled, all other configuration options of this executor service are ignored!
- Returns:
- the virtual threads
-
corePoolSize
public int corePoolSize()Core pool size of the thread pool executor. Defaults to 10.- Returns:
- the core pool size
-
maxPoolSize
public int maxPoolSize()Max pool size of the thread pool executor. Defaults to 50.- Returns:
- the max pool size
-
keepAlive
Keep alive of the thread pool executor. Defaults to "PT3M".- Returns:
- the keep alive
-
queueCapacity
public int queueCapacity()Queue capacity of the thread pool executor. Defaults to 10000.- Returns:
- the queue capacity
-
daemon
public boolean daemon()Is daemon of the thread pool executor. Defaults to true.- Returns:
- the daemon
-
name
Name of this thread pool executor.- Returns:
- the name
-
growthThreshold
public int growthThreshold()The queue size above which pool growth will be considered if the pool is not fixed size. Defaults to 1000.- Returns:
- the growth threshold
-
growthRate
public int growthRate()The percentage of task submissions that should result in adding threads, expressed as a value from 1 to 100. The rate applies only when all of the following are true:- the pool size is below the maximum, and
- there are no idle threads, and
- the number of tasks in the queue exceeds the
growthThreshold
Defaults to 0
- Returns:
- the growth rate
-
rejectionHandler
Rejection policy of the thread pool executor.- Returns:
- the rejection handler
-
threadNamePrefix
Name prefix for threads in this thread pool executor. Defaults to "helidon-".- Returns:
- the thread name prefix
-
shouldPrestart
public boolean shouldPrestart()Whether to prestart core threads in this thread pool executor. Defaults to true.- Returns:
- the should prestart
-
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.
-