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 int
Default core pool size (10).static final int
Default growth rate (0).static final int
Default growth threshold (1000).static final boolean
Default is daemon (true).static final String
Default keep alive (duration format - "PT3M").static final int
Default max pool size (50).static final boolean
Default prestart of threads (true).static final int
Default queue capacity (10000).static final String
Default thread name prefix ("helidon-"). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ThreadPoolConfigImpl
(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.int
Core pool size of the thread pool executor.boolean
daemon()
Is daemon of the thread pool executor.boolean
get()
int
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.int
hashCode()
Keep alive of the thread pool executor.int
Max pool size of the thread pool executor.name()
Name of this thread pool executor.int
Queue capacity of the thread pool executor.Rejection policy of the thread pool executor.boolean
Whether to prestart core threads in this thread pool executor.Name prefix for threads in this thread pool executor.toString()
boolean
When 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.Factory
Create a new instance of the runtime type from this config object.- Specified by:
build
in interfacePrototype.Factory<ThreadPoolSupplier>
- Returns:
- new configured runtime instance
-
get
- Specified by:
get
in interfaceSupplier<ThreadPoolSupplier>
-
virtualThreads
public boolean virtualThreads()Description copied from interface:ThreadPoolConfig
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!
- Specified by:
virtualThreads
in interfaceThreadPoolConfig
- Returns:
- whether to use virtual threads or not, defaults to
false
-
corePoolSize
public int corePoolSize()Description copied from interface:ThreadPoolConfig
Core pool size of the thread pool executor. Defaults to 10.- Specified by:
corePoolSize
in interfaceThreadPoolConfig
- Returns:
- corePoolSize see
ThreadPoolExecutor.getCorePoolSize()
-
maxPoolSize
public int maxPoolSize()Description copied from interface:ThreadPoolConfig
Max pool size of the thread pool executor. Defaults to 50.- Specified by:
maxPoolSize
in interfaceThreadPoolConfig
- Returns:
- maxPoolSize see
ThreadPoolExecutor.getMaximumPoolSize()
-
keepAlive
Description copied from interface:ThreadPoolConfig
Keep alive of the thread pool executor. Defaults to "PT3M".- Specified by:
keepAlive
in interfaceThreadPoolConfig
- Returns:
- keep alive see
ThreadPoolExecutor.getKeepAliveTime(java.util.concurrent.TimeUnit)
-
queueCapacity
public int queueCapacity()Description copied from interface:ThreadPoolConfig
Queue capacity of the thread pool executor. Defaults to 10000.- Specified by:
queueCapacity
in interfaceThreadPoolConfig
- Returns:
- capacity of the queue backing the executor
-
daemon
public boolean daemon()Description copied from interface:ThreadPoolConfig
Is daemon of the thread pool executor. Defaults to true.- Specified by:
daemon
in interfaceThreadPoolConfig
- Returns:
- whether the threads are daemon threads
-
name
Description copied from interface:ThreadPoolConfig
Name of this thread pool executor.- Specified by:
name
in interfaceThreadPoolConfig
- Returns:
- the pool name
-
growthThreshold
public int growthThreshold()Description copied from interface:ThreadPoolConfig
The queue size above which pool growth will be considered if the pool is not fixed size. Defaults to 1000.- Specified by:
growthThreshold
in interfaceThreadPoolConfig
- Returns:
- the growth threshold
-
growthRate
public int growthRate()Description copied from interface:ThreadPoolConfig
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
- Specified by:
growthRate
in interfaceThreadPoolConfig
- Returns:
- the growth rate
-
rejectionHandler
Description copied from interface:ThreadPoolConfig
Rejection policy of the thread pool executor.- Specified by:
rejectionHandler
in interfaceThreadPoolConfig
- Returns:
- the rejection handler
-
threadNamePrefix
Description copied from interface:ThreadPoolConfig
Name prefix for threads in this thread pool executor. Defaults to "helidon-".- Specified by:
threadNamePrefix
in interfaceThreadPoolConfig
- Returns:
- prefix of a thread name
-
shouldPrestart
public boolean shouldPrestart()Description copied from interface:ThreadPoolConfig
Whether to prestart core threads in this thread pool executor. Defaults to true.- Specified by:
shouldPrestart
in interfaceThreadPoolConfig
- Returns:
- whether to prestart the threads
-
toString
-
equals
-
hashCode
public int hashCode()
-