Package jodd.util
Class ThreadFactoryBuilder
java.lang.Object
jodd.util.ThreadFactoryBuilder
Fluent
ThreadFactory builder.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ThreadFactoryprivate Booleanprivate Stringprivate Integerprivate Thread.UncaughtExceptionHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ThreadFactoryBuildercreate()Returns newThreadFactorybuilder.get()Returns a new thread factory using the options supplied during the building process.private static ThreadFactoryget(ThreadFactoryBuilder builder) withBackingThreadFactory(ThreadFactory backingThreadFactory) Sets the backingThreadFactoryfor new threads.withDaemon(boolean daemon) Sets if new threads will be daemon.withNameFormat(String nameFormat) Sets the printf-compatible naming format for threads.withPriority(int priority) Sets the threads priority.withUncaughtExceptionHandler(Thread.UncaughtExceptionHandler uncaughtExceptionHandler) Sets theUncaughtExceptionHandlerfor new threads created.
-
Field Details
-
nameFormat
-
daemonThread
-
priority
-
uncaughtExceptionHandler
-
backingThreadFactory
-
-
Constructor Details
-
ThreadFactoryBuilder
public ThreadFactoryBuilder()
-
-
Method Details
-
create
Returns newThreadFactorybuilder. -
withNameFormat
Sets the printf-compatible naming format for threads. Use%dto replace it with the thread number. -
withDaemon
Sets if new threads will be daemon. -
withPriority
Sets the threads priority. -
withUncaughtExceptionHandler
public ThreadFactoryBuilder withUncaughtExceptionHandler(Thread.UncaughtExceptionHandler uncaughtExceptionHandler) Sets theUncaughtExceptionHandlerfor new threads created. -
withBackingThreadFactory
Sets the backingThreadFactoryfor new threads. Threads will be created by invokingnewThread(Runnableon this backing factory. -
get
Returns a new thread factory using the options supplied during the building process. After building, it is still possible to change the options used to build the ThreadFactory and/or build again. -
get
-