public interface ThreadFactory
new Thread
, enabling applications to use special thread subclasses, priorities, etc.
The simplest implementation of this interface is just:
class SimpleThreadFactory implements ThreadFactory { public Thread newThread(Runnable r) { return new Thread(r); } }
Modifier and Type | Method and Description |
---|---|
java.lang.Thread |
newThread(java.lang.Runnable r)
Constructs a new
Thread . |
java.lang.Thread newThread(java.lang.Runnable r)
Thread
. Implementations may also initialize priority, name, daemon status,
ThreadGroup
, etc.r
- a runnable to be executed by new thread instancenull
if the request to create a thread is rejected