Package io.helidon.common.configurable
Class ThreadPoolSupplier.Builder
- java.lang.Object
-
- io.helidon.common.configurable.ThreadPoolSupplier.Builder
-
- All Implemented Interfaces:
Builder<ThreadPoolSupplier>,Supplier<ThreadPoolSupplier>
- Enclosing class:
- ThreadPoolSupplier
public static final class ThreadPoolSupplier.Builder extends Object implements Builder<ThreadPoolSupplier>
A fluent API builder forThreadPoolSupplier.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThreadPoolSupplierbuild()Build the instance from this builder.ThreadPoolSupplier.Builderconfig(Config config)Load all properties for this thread pool executor from configuration.ThreadPoolSupplier.BuildercorePoolSize(int corePoolSize)Core pool size of the thread pool executor.ThreadPoolSupplier.Builderdaemon(boolean daemon)Is daemon of the thread pool executor.ThreadPoolSupplier.BuilderkeepAliveMinutes(int keepAliveMinutes)Keep alive minutes of the thread pool executor.ThreadPoolSupplier.BuildermaxPoolSize(int maxPoolSize)Max pool size of the thread pool executor.ThreadPoolSupplier.Buildername(String name)Name of this thread pool executor.ThreadPoolSupplier.Builderprestart(boolean prestart)Whether to prestart core threads in this thread pool executor.ThreadPoolSupplier.BuilderqueueCapacity(int queueCapacity)Queue capacity of the thread pool executor.ThreadPoolSupplier.BuilderthreadNamePrefix(String threadNamePrefix)Name prefix for threads in this thread pool executor.
-
-
-
Method Detail
-
build
public ThreadPoolSupplier build()
Description copied from interface:BuilderBuild the instance from this builder.- Specified by:
buildin interfaceBuilder<ThreadPoolSupplier>- Returns:
- instance of the built type
-
corePoolSize
public ThreadPoolSupplier.Builder corePoolSize(int corePoolSize)
Core pool size of the thread pool executor.- Parameters:
corePoolSize- seeThreadPoolExecutor.getCorePoolSize()- Returns:
- updated builder instance
-
maxPoolSize
public ThreadPoolSupplier.Builder maxPoolSize(int maxPoolSize)
Max pool size of the thread pool executor.- Parameters:
maxPoolSize- seeThreadPoolExecutor.getMaximumPoolSize()- Returns:
- updated builder instance
-
keepAliveMinutes
public ThreadPoolSupplier.Builder keepAliveMinutes(int keepAliveMinutes)
Keep alive minutes of the thread pool executor.- Parameters:
keepAliveMinutes- seeThreadPoolExecutor.getKeepAliveTime(TimeUnit)- Returns:
- updated builder instance
-
queueCapacity
public ThreadPoolSupplier.Builder queueCapacity(int queueCapacity)
Queue capacity of the thread pool executor.- Parameters:
queueCapacity- capacity of the queue backing the executor- Returns:
- updated builder instance
-
daemon
public ThreadPoolSupplier.Builder daemon(boolean daemon)
Is daemon of the thread pool executor.- Parameters:
daemon- whether the threads are daemon threads- Returns:
- updated builder instance
-
name
public ThreadPoolSupplier.Builder name(String name)
Name of this thread pool executor.- Parameters:
name- the pool name- Returns:
- updated builder instance
-
threadNamePrefix
public ThreadPoolSupplier.Builder threadNamePrefix(String threadNamePrefix)
Name prefix for threads in this thread pool executor.- Parameters:
threadNamePrefix- prefix of a thread name- Returns:
- updated builder instance
-
prestart
public ThreadPoolSupplier.Builder prestart(boolean prestart)
Whether to prestart core threads in this thread pool executor.- Parameters:
prestart- whether to prestart the threads- Returns:
- updated builder instance
-
config
public ThreadPoolSupplier.Builder config(Config config)
Load all properties for this thread pool executor from configuration. Expected keys:- core-pool-size
- max-pool-size
- keep-alive-minutes
- queue-capacity
- is-daemon
- thread-name-prefix
- should-prestart
- Parameters:
config- config located on the key of executor-service- Returns:
- updated builder instance
-
-