Package io.helidon.common.configurable
Class ThreadPoolConfig.BuilderBase.ThreadPoolConfigImpl
java.lang.Object
io.helidon.common.configurable.ThreadPoolConfig.BuilderBase.ThreadPoolConfigImpl
- All Implemented Interfaces:
Prototype.Api,Prototype.Factory<ThreadPoolSupplier>,ThreadPoolConfig,Supplier<ThreadPoolSupplier>
- Enclosing class:
ThreadPoolConfig.BuilderBase<BUILDER extends ThreadPoolConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends ThreadPoolConfig>
protected static class ThreadPoolConfig.BuilderBase.ThreadPoolConfigImpl
extends Object
implements ThreadPoolConfig, Supplier<ThreadPoolSupplier>
Generated implementation of the prototype, can be extended by descendant prototype implementations.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.helidon.common.configurable.ThreadPoolConfig
ThreadPoolConfig.Builder, ThreadPoolConfig.BuilderBase<BUILDER extends ThreadPoolConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends ThreadPoolConfig> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault core pool size (10).static final intDefault growth rate (0).static final intDefault growth threshold (1000).static final booleanDefault is daemon (true).static final StringDefault keep alive (duration format - "PT3M").static final intDefault max pool size (50).static final booleanDefault prestart of threads (true).static final intDefault queue capacity (10000).static final StringDefault thread name prefix ("helidon-"). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedThreadPoolConfigImpl(ThreadPoolConfig.BuilderBase<?, ?> builder) Create an instance providing a builder. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Create a new instance of the runtime type from this config object.intCore pool size of the thread pool executor.booleandaemon()Is daemon of the thread pool executor.booleanget()intThe 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.inthashCode()Keep alive of the thread pool executor.intMax pool size of the thread pool executor.name()Name of this thread pool executor.intQueue capacity of the thread pool executor.Rejection policy of the thread pool executor.booleanWhether to prestart core threads in this thread pool executor.Name prefix for threads in this thread pool executor.toString()booleanWhen configured totrue, an unbounded virtual executor service (project Loom) will be used.
-
Field Details
-
DEFAULT_CORE_POOL_SIZE
static final int DEFAULT_CORE_POOL_SIZEDefault core pool size (10).- See Also:
-
DEFAULT_MAX_POOL_SIZE
static final int DEFAULT_MAX_POOL_SIZEDefault max pool size (50).- See Also:
-
DEFAULT_KEEP_ALIVE
Default keep alive (duration format - "PT3M").- See Also:
-
DEFAULT_QUEUE_CAPACITY
static final int DEFAULT_QUEUE_CAPACITYDefault queue capacity (10000).- See Also:
-
DEFAULT_IS_DAEMON
static final boolean DEFAULT_IS_DAEMONDefault is daemon (true).- See Also:
-
DEFAULT_THREAD_NAME_PREFIX
Default thread name prefix ("helidon-").- See Also:
-
DEFAULT_PRESTART
static final boolean DEFAULT_PRESTARTDefault prestart of threads (true).- See Also:
-
DEFAULT_GROWTH_RATE
static final int DEFAULT_GROWTH_RATEDefault growth rate (0).- See Also:
-
DEFAULT_GROWTH_THRESHOLD
static final int DEFAULT_GROWTH_THRESHOLDDefault growth threshold (1000).- See Also:
-
-
Constructor Details
-
ThreadPoolConfigImpl
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<ThreadPoolSupplier>- Returns:
- new configured runtime instance
-
get
- Specified by:
getin interfaceSupplier<ThreadPoolSupplier>
-
virtualThreads
public boolean virtualThreads()Description copied from interface:ThreadPoolConfigWhen configured totrue, an unbounded virtual executor service (project Loom) will be used.If enabled, all other configuration options of this executor service are ignored!
- Specified by:
virtualThreadsin interfaceThreadPoolConfig- Returns:
- whether to use virtual threads or not, defaults to
false
-
corePoolSize
public int corePoolSize()Description copied from interface:ThreadPoolConfigCore pool size of the thread pool executor. Defaults to 10.- Specified by:
corePoolSizein interfaceThreadPoolConfig- Returns:
- corePoolSize see
ThreadPoolExecutor.getCorePoolSize()
-
maxPoolSize
public int maxPoolSize()Description copied from interface:ThreadPoolConfigMax pool size of the thread pool executor. Defaults to 50.- Specified by:
maxPoolSizein interfaceThreadPoolConfig- Returns:
- maxPoolSize see
ThreadPoolExecutor.getMaximumPoolSize()
-
keepAlive
Description copied from interface:ThreadPoolConfigKeep alive of the thread pool executor. Defaults to "PT3M".- Specified by:
keepAlivein interfaceThreadPoolConfig- Returns:
- keep alive see
ThreadPoolExecutor.getKeepAliveTime(java.util.concurrent.TimeUnit)
-
queueCapacity
public int queueCapacity()Description copied from interface:ThreadPoolConfigQueue capacity of the thread pool executor. Defaults to 10000.- Specified by:
queueCapacityin interfaceThreadPoolConfig- Returns:
- capacity of the queue backing the executor
-
daemon
public boolean daemon()Description copied from interface:ThreadPoolConfigIs daemon of the thread pool executor. Defaults to true.- Specified by:
daemonin interfaceThreadPoolConfig- Returns:
- whether the threads are daemon threads
-
name
Description copied from interface:ThreadPoolConfigName of this thread pool executor.- Specified by:
namein interfaceThreadPoolConfig- Returns:
- the pool name
-
growthThreshold
public int growthThreshold()Description copied from interface:ThreadPoolConfigThe queue size above which pool growth will be considered if the pool is not fixed size. Defaults to 1000.- Specified by:
growthThresholdin interfaceThreadPoolConfig- Returns:
- the growth threshold
-
growthRate
public int growthRate()Description copied from interface:ThreadPoolConfigThe 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
- Specified by:
growthRatein interfaceThreadPoolConfig- Returns:
- the growth rate
-
rejectionHandler
Description copied from interface:ThreadPoolConfigRejection policy of the thread pool executor.- Specified by:
rejectionHandlerin interfaceThreadPoolConfig- Returns:
- the rejection handler
-
threadNamePrefix
Description copied from interface:ThreadPoolConfigName prefix for threads in this thread pool executor. Defaults to "helidon-".- Specified by:
threadNamePrefixin interfaceThreadPoolConfig- Returns:
- prefix of a thread name
-
shouldPrestart
public boolean shouldPrestart()Description copied from interface:ThreadPoolConfigWhether to prestart core threads in this thread pool executor. Defaults to true.- Specified by:
shouldPrestartin interfaceThreadPoolConfig- Returns:
- whether to prestart the threads
-
toString
-
equals
-
hashCode
public int hashCode()
-