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> ConfigBuilderSupport.ConfiguredBuilder<BUILDER,,PROTOTYPE> ConfigBuilderSupport.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 ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for
ThreadPoolConfig.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classGenerated implementation of the prototype, can be extended by descendant prototype implementations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClear existing value of name.Clear existing value of threadNamePrefix.config()Configuration used to configure this instance.Deprecated.Update builder from configuration (node of this type).intCore pool size of the thread pool executor.corePoolSize(int corePoolSize) Core pool size of the thread pool executor.booleandaemon()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.intThe 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.intThe 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.intMax 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 voidHandles providers and decorators.intQueue 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.booleanWhether 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 voidValidates required properties.booleanWhen 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, waitMethods inherited from interface io.helidon.builder.api.Prototype.Builder
buildPrototype, self
-
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
Deprecated.Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.- Specified by:
configin interfaceConfigBuilderSupport.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
-
config
Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.- Specified by:
configin interfaceConfigBuilderSupport.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 name.- 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 threadNamePrefix.- 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:
- whether to use virtual threads or not, defaults to
false
-
corePoolSize
public int corePoolSize()Core pool size of the thread pool executor. Defaults to 10.- Returns:
- corePoolSize see
ThreadPoolExecutor.getCorePoolSize()
-
maxPoolSize
public int maxPoolSize()Max pool size of the thread pool executor. Defaults to 50.- Returns:
- maxPoolSize see
ThreadPoolExecutor.getMaximumPoolSize()
-
keepAlive
Keep alive of the thread pool executor. Defaults to "PT3M".- Returns:
- keep alive see
ThreadPoolExecutor.getKeepAliveTime(java.util.concurrent.TimeUnit)
-
queueCapacity
public int queueCapacity()Queue capacity of the thread pool executor. Defaults to 10000.- Returns:
- capacity of the queue backing the executor
-
daemon
public boolean daemon()Is daemon of the thread pool executor. Defaults to true.- Returns:
- whether the threads are daemon threads
-
name
Name of this thread pool executor.- Returns:
- the pool 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:
- prefix of a thread name
-
shouldPrestart
public boolean shouldPrestart()Whether to prestart core threads in this thread pool executor. Defaults to true.- Returns:
- whether to prestart the threads
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties. -
config
Configuration used to configure this instance.- Returns:
- config instance
-
config(io.helidon.config.Config)