public class NamedThreadFactory extends Object implements ThreadFactory
| Modifier and Type | Field and Description |
|---|---|
static ThreadGroup |
COAP_THREAD_GROUP
The default thread group for Californium threads.
|
static ThreadGroup |
SCANDIUM_THREAD_GROUP
The default thread group for Scandium threads.
|
| Constructor and Description |
|---|
NamedThreadFactory(String threadPrefix)
Creates a new factory and sets the thread group to Californium
default group.
|
NamedThreadFactory(String threadPrefix,
ThreadGroup threadGroup)
Creates a new factory.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
createDaemonThreads()
Checks whether this factory creates daemon threads.
|
Thread |
newThread(Runnable runnable)
Creates a new thread for executing a runnable.
|
public static final ThreadGroup COAP_THREAD_GROUP
public static final ThreadGroup SCANDIUM_THREAD_GROUP
public NamedThreadFactory(String threadPrefix)
threadPrefix - the prefix, that becomes part of the name of all
threads, created by this factory.public NamedThreadFactory(String threadPrefix, ThreadGroup threadGroup)
threadPrefix - the prefix, that becomes part of the name of all
threads, created by this factory.threadGroup - the thread group or nullpublic final Thread newThread(Runnable runnable)
The thread created will be a member of the thread group set during instantiation of this
factory. The thread's priority will be set to Thread.NORM_PRIORITY.
newThread in interface ThreadFactoryrunnable - The runnable that should be executed by the created thread.createDaemonThreads()protected boolean createDaemonThreads()
This method is invoked by newThread(Runnable) right after a new thread has
been created. The Thread.setDaemon(boolean) method is invoked with this method's
return value.
true if all threads created by this factory are daemon threads. This implementation
returns false. Subclasses should override this method and return true in order
to create daemon threads.Copyright © 2019 Eclipse Foundation. All rights reserved.