public static class ConfigurableThreadFactory.ConfigurableThreadFactoryBuilder
extends java.lang.Object
ConfigurableThreadFactory. When ready invoke
build() to construct the new factory.| Constructor and Description |
|---|
ConfigurableThreadFactoryBuilder() |
| Modifier and Type | Method and Description |
|---|---|
ConfigurableThreadFactory.ConfigurableThreadFactoryBuilder |
appendPoolIdToPrefix(boolean appendPoolIdToPrefix)
Sets if a unique pool id should be appended to the prefix of thread names.
|
ConfigurableThreadFactory |
build()
Call to construct the
ConfigurableThreadFactory when configuration is ready. |
ConfigurableThreadFactory.ConfigurableThreadFactoryBuilder |
exceptionHandler(ExceptionHandler exceptionHandler)
Sets an
ExceptionHandler to be set for these newly created threads. |
ConfigurableThreadFactory.ConfigurableThreadFactoryBuilder |
threadNamePrefix(java.lang.String threadNamePrefix)
Call to set the prefix for newly created threads names.
|
ConfigurableThreadFactory.ConfigurableThreadFactoryBuilder |
threadPriority(int threadPriority)
Sets the priority associated to the thread.
|
ConfigurableThreadFactory.ConfigurableThreadFactoryBuilder |
useDaemonThreads(boolean useDaemonThreads)
Sets of the created threads should be started with daemon status.
|
public ConfigurableThreadFactory.ConfigurableThreadFactoryBuilder threadNamePrefix(java.lang.String threadNamePrefix)
"pool-". See appendPoolIdToPrefix(boolean) for determining the behavior
of a pool ID following this prefix.threadNamePrefix - Prefix for thread name or null to use the defaultthis instancepublic ConfigurableThreadFactory.ConfigurableThreadFactoryBuilder appendPoolIdToPrefix(boolean appendPoolIdToPrefix)
appendPoolIdToPrefix - True to indicate an auto incrementing pool id should be included in the namethis instancepublic ConfigurableThreadFactory.ConfigurableThreadFactoryBuilder useDaemonThreads(boolean useDaemonThreads)
useDaemonThreads - True if started threads should be set as daemonthis instancepublic ConfigurableThreadFactory.ConfigurableThreadFactoryBuilder threadPriority(int threadPriority)
Thread.MIN_PRIORITY and Thread.MAX_PRIORITY.threadPriority - The priority value to be set on new threadsthis instancepublic ConfigurableThreadFactory.ConfigurableThreadFactoryBuilder exceptionHandler(ExceptionHandler exceptionHandler)
ExceptionHandler to be set for these newly created threads. Typically
ExceptionUtils.setInheritableExceptionHandler(ExceptionHandler) or
ExceptionUtils.setDefaultExceptionHandler(ExceptionHandler) are better options.
However this allows you to set an ExceptionHandler for threads specifically created
from this ThreadFactory.exceptionHandler - Handler to be delegated to for errors in produced threadsthis instancepublic ConfigurableThreadFactory build()
ConfigurableThreadFactory when configuration is ready.