Package io.helidon.common.configurable
Class ThreadPoolSupplier
java.lang.Object
io.helidon.common.configurable.ThreadPoolSupplier
- All Implemented Interfaces:
RuntimeType.Api<ThreadPoolConfig>
,Supplier<ExecutorService>
public final class ThreadPoolSupplier
extends Object
implements Supplier<ExecutorService>, RuntimeType.Api<ThreadPoolConfig>
Supplier of a custom thread pool.
The returned thread pool supports
Context
propagation.-
Method Summary
Modifier and TypeMethodDescriptionstatic ThreadPoolConfig.Builder
builder()
Create a new fluent API builder to build thread pool supplier.int
Returns size of core pool.static ThreadPoolSupplier
Load supplier from configuration.static ThreadPoolSupplier
create
(ThreadPoolConfig config) Create a new thread pool supplier based on its configuration.static ThreadPoolSupplier
Create a new thread pool supplier with default configuration and a given name.static ThreadPoolSupplier
create
(Consumer<ThreadPoolConfig.Builder> consumer) Create a new thread pool supplier customizing its configuration.get()
The prototype as it was received when creating this runtime object instance.
-
Method Details
-
builder
Create a new fluent API builder to build thread pool supplier.- Returns:
- a builder instance
-
create
Load supplier from configuration.- Parameters:
config
- config instancename
- thread pool name- Returns:
- a new thread pool supplier configured from config
-
create
Create a new thread pool supplier with default configuration and a given name.- Parameters:
name
- thread pool name- Returns:
- a new thread pool supplier with default configuration
-
create
Create a new thread pool supplier based on its configuration.- Parameters:
config
- configuration- Returns:
- a new thread pool supplier
-
create
Create a new thread pool supplier customizing its configuration.- Parameters:
consumer
- configuration consumer- Returns:
- a new thread pool supplier
-
prototype
Description copied from interface:RuntimeType.Api
The prototype as it was received when creating this runtime object instance.- Specified by:
prototype
in interfaceRuntimeType.Api<ThreadPoolConfig>
- Returns:
- prototype object used to create this instance
-
get
- Specified by:
get
in interfaceSupplier<ExecutorService>
-
corePoolSize
public int corePoolSize()Returns size of core pool.- Returns:
- size of core pool.
-