public class DaemonFactory extends Object implements ThreadFactory
DaemonFactory object is used to build threads
and prefix the thread with a type name. Prefixing the threads with
the type that it represents allows the purpose of the thread to
be determined and also provides better debug information.| Constructor and Description |
|---|
DaemonFactory()
Constructor for the
DaemonFactory object. |
DaemonFactory(Class type)
Constructor for the
DaemonFactory object. |
| Modifier and Type | Method and Description |
|---|---|
Thread |
newThread(Runnable task)
This is used to create a thread from the provided runnable.
|
Thread |
newThread(Runnable task,
Class type)
This is used to create a thread from the provided runnable.
|
public DaemonFactory()
DaemonFactory object. This
will provide a thread factory that names the threads based
on the type of Runnable the pool executes.public DaemonFactory(Class type)
DaemonFactory object. This
will provide a thread factory that names the threads based
on the type of Runnable the pool executes. Each
of the threads is given a unique sequence number.type - this is the type of runnable this will executepublic Thread newThread(Runnable task)
newThread in interface ThreadFactorytask - this is the task that the thread is to executepublic Thread newThread(Runnable task, Class type)
task - this is the task that the thread is to executetype - this is the type of object the thread is to executeCopyright © 2024. All rights reserved.