public static class BasicThreadFactory.Builder extends Object implements Builder<BasicThreadFactory>
BasicThreadFactory.
Using this builder class instances of BasicThreadFactory can be
created and initialized. The class provides methods that correspond to
the configuration options supported by BasicThreadFactory. Method
chaining is supported. Refer to the documentation of BasicThreadFactory for a usage example.
| Constructor and Description |
|---|
Builder()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
BasicThreadFactory |
build()
Creates a new
BasicThreadFactory with all configuration
options that have been specified by calling methods on this builder. |
BasicThreadFactory.Builder |
daemon()
Sets the daemon flag for the new
BasicThreadFactory to true causing a new thread factory to create daemon threads. |
BasicThreadFactory.Builder |
daemon(boolean daemon)
Sets the daemon flag for the new
BasicThreadFactory. |
BasicThreadFactory.Builder |
namingPattern(String namingPattern)
Sets the naming pattern to be used by the new
BasicThreadFactory. |
BasicThreadFactory.Builder |
priority(int priority)
Sets the priority for the threads created by the new
BasicThreadFactory. |
void |
reset()
Resets this builder.
|
BasicThreadFactory.Builder |
uncaughtExceptionHandler(Thread.UncaughtExceptionHandler exceptionHandler)
Sets the uncaught exception handler for the threads created by the
new
BasicThreadFactory. |
BasicThreadFactory.Builder |
wrappedFactory(ThreadFactory factory)
Sets the
ThreadFactory to be wrapped by the new BasicThreadFactory. |
@Deprecated public Builder()
BasicThreadFactory.builder().public BasicThreadFactory build()
BasicThreadFactory with all configuration
options that have been specified by calling methods on this builder.
After creating the factory reset() is called.build in interface Builder<BasicThreadFactory>BasicThreadFactorypublic BasicThreadFactory.Builder daemon()
BasicThreadFactory to true causing a new thread factory to create daemon threads.BasicThreadFactory.Builderpublic BasicThreadFactory.Builder daemon(boolean daemon)
BasicThreadFactory. If this
flag is set to true the new thread factory will create daemon
threads.daemon - the value of the daemon flagBasicThreadFactory.Builderpublic BasicThreadFactory.Builder namingPattern(String namingPattern)
BasicThreadFactory.namingPattern - the naming pattern (must not be null)BasicThreadFactory.BuilderNullPointerException - if the naming pattern is nullpublic BasicThreadFactory.Builder priority(int priority)
BasicThreadFactory.priority - the priorityBasicThreadFactory.Builderpublic void reset()
build() method was called, it is not
necessary to call reset() explicitly because this is done
automatically.public BasicThreadFactory.Builder uncaughtExceptionHandler(Thread.UncaughtExceptionHandler exceptionHandler)
BasicThreadFactory.exceptionHandler - the Thread.UncaughtExceptionHandler (must not be
null)BasicThreadFactory.BuilderNullPointerException - if the exception handler is nullpublic BasicThreadFactory.Builder wrappedFactory(ThreadFactory factory)
ThreadFactory to be wrapped by the new BasicThreadFactory.factory - the wrapped ThreadFactory (must not be
null)BasicThreadFactory.BuilderNullPointerException - if the passed in ThreadFactory
is nullCopyright © 2001–2025 The Apache Software Foundation. All rights reserved.