Package io.helidon.common.configurable
Interface ThreadPoolConfig
- All Superinterfaces:
Prototype.Api
,Prototype.Factory<ThreadPoolSupplier>
- All Known Implementing Classes:
ThreadPoolConfig.BuilderBase.ThreadPoolConfigImpl
Interface generated from definition. Please add javadoc to the definition interface.
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Fluent API builder forThreadPoolSupplier
.static class
ThreadPoolConfig.BuilderBase<BUILDER extends ThreadPoolConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends ThreadPoolConfig> Fluent API builder base forThreadPoolSupplier
. -
Field Summary
Modifier 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-"). -
Method Summary
Modifier and TypeMethodDescriptionstatic ThreadPoolConfig.Builder
builder()
Create a new fluent API builder to customize configuration.static ThreadPoolConfig.Builder
builder
(ThreadPoolConfig instance) Create a new fluent API builder from an existing instance.int
Core pool size of the thread pool executor.static ThreadPoolConfig
create()
Create a new instance with default values.static ThreadPoolConfig
Create a new instance from configuration.boolean
daemon()
Is daemon of the thread pool executor.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.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.boolean
When configured totrue
, an unbounded virtual executor service (project Loom) will be used.Methods inherited from interface io.helidon.builder.api.Prototype.Factory
build
-
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:
-
-
Method Details
-
builder
Create a new fluent API builder to customize configuration.- Returns:
- a new builder
-
builder
Create a new fluent API builder from an existing instance.- Parameters:
instance
- an existing instance used as a base for the builder- Returns:
- a builder based on an instance
-
create
Create a new instance from configuration.- Parameters:
config
- used to configure the new instance- Returns:
- a new instance configured from configuration
-
create
Create a new instance with default values.- Returns:
- a new instance
-
virtualThreads
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
int corePoolSize()Core pool size of the thread pool executor. Defaults to 10.- Returns:
- corePoolSize see
ThreadPoolExecutor.getCorePoolSize()
-
maxPoolSize
int maxPoolSize()Max pool size of the thread pool executor. Defaults to 50.- Returns:
- maxPoolSize see
ThreadPoolExecutor.getMaximumPoolSize()
-
keepAlive
Duration keepAlive()Keep alive of the thread pool executor. Defaults to "PT3M".- Returns:
- keep alive see
ThreadPoolExecutor.getKeepAliveTime(java.util.concurrent.TimeUnit)
-
queueCapacity
int queueCapacity()Queue capacity of the thread pool executor. Defaults to 10000.- Returns:
- capacity of the queue backing the executor
-
daemon
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
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
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
ThreadPool.RejectionHandler 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
boolean shouldPrestart()Whether to prestart core threads in this thread pool executor. Defaults to true.- Returns:
- whether to prestart the threads
-