public static class BasicThreadFactory.Builder extends Object
A builder class for creating instances of 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() |
| 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 |
build(boolean bReset)
Creates a new
BasicThreadFactory with all configuration options
that have been specified by calling methods on this builder. |
void |
reset()
Resets this builder.
|
BasicThreadFactory.Builder |
setDaemon(boolean bDaemon)
Sets the daemon flag for the new
BasicThreadFactory. |
BasicThreadFactory.Builder |
setNamingPattern(String sNamingPattern)
Sets the naming pattern to be used by the new
BasicThreadFactory. |
BasicThreadFactory.Builder |
setPriority(int nPriority)
Sets the priority for the threads created by the new
BasicThreadFactory. |
BasicThreadFactory.Builder |
setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler aExceptionHandler)
Sets the uncaught exception handler for the threads created by the new
BasicThreadFactory. |
BasicThreadFactory.Builder |
setWrappedFactory(ThreadFactory aWrappedFactory)
Sets the
ThreadFactory to be wrapped by the new BasicThreadFactory. |
@Nonnull public BasicThreadFactory.Builder setWrappedFactory(ThreadFactory aWrappedFactory)
ThreadFactory to be wrapped by the new BasicThreadFactory.aWrappedFactory - the wrapped ThreadFactory (must not be null)BuilderNullPointerException - if the passed in ThreadFactory is null@Nonnull public BasicThreadFactory.Builder setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler aExceptionHandler)
BasicThreadFactory.aExceptionHandler - the UncaughtExceptionHandler (must not be null)BuilderNullPointerException - if the exception handler is null@Nonnull public BasicThreadFactory.Builder setNamingPattern(String sNamingPattern)
BasicThreadFactory. The formatting is done with
String.format(String, Object...) using the thread counter (type
long) as the only parameter.sNamingPattern - the naming pattern (must not be null)BuilderNullPointerException - if the naming pattern is null@Nonnull public BasicThreadFactory.Builder setPriority(int nPriority)
BasicThreadFactory.nPriority - the priorityBuilder@Nonnull public BasicThreadFactory.Builder setDaemon(boolean bDaemon)
BasicThreadFactory. If this flag
is set to true the new thread factory will create daemon threads.bDaemon - the value of the daemon flagBuilderpublic void reset()
build() method was called, it is not necessary to
call reset() explicitly because this is done automatically.@Nonnull 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.BasicThreadFactory@Nonnull public BasicThreadFactory build(boolean bReset)
BasicThreadFactory with all configuration options
that have been specified by calling methods on this builder.bReset - if true, reset() is called after creating the factoryBasicThreadFactoryCopyright © 2014–2017 Philip Helger. All rights reserved.