public class ConfigurableThreadFactory extends Object implements ThreadFactory
ThreadPoolExecutor
. The factory can be
configured to customise the names, priority and daemon status of created
threads.Constructor and Description |
---|
ConfigurableThreadFactory(String namePrefix,
int priority,
boolean daemon) |
ConfigurableThreadFactory(String namePrefix,
int priority,
boolean daemon,
Thread.UncaughtExceptionHandler uncaughtExceptionHandler) |
Modifier and Type | Method and Description |
---|---|
Thread |
newThread(Runnable runnable)
Creates a new thread configured according to this factory's parameters.
|
public ConfigurableThreadFactory(String namePrefix, int priority, boolean daemon)
namePrefix
- The String prefix used to assign identifiers to created threads.priority
- The initial priority for created threads.daemon
- Whether or not created threads should be daemon threads or user threads.
The JVM exits when the only threads running are all daemon threads.public ConfigurableThreadFactory(String namePrefix, int priority, boolean daemon, Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
namePrefix
- The String prefix used to assign identifiers to created threads.priority
- The initial priority for created threads.daemon
- Whether or not created threads should be daemon threads or user threads.
The JVM exits when the only threads running are all daemon threads.uncaughtExceptionHandler
- A strategy for dealing with uncaught exceptions.public Thread newThread(Runnable runnable)
newThread
in interface ThreadFactory
runnable
- The runnable to be executed by the new thread.