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 |
|---|---|
Thread |
newThread(Runnable r)
Constructs a new
Thread. |
@Nullable Thread newThread(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