public class DefaultThreadFactory extends Object implements ThreadFactory
DefaultThreadFactory
creates WorkerTask
instances
that allow concurrent execution of tasks. By default it uses a timeout
of 60 seconds (1 min.) when joining threads on behalf of an call of the
WorkerTask.join()
method. By settingModifier and Type | Class and Description |
---|---|
class |
DefaultThreadFactory.WorkerThread |
Constructor and Description |
---|
DefaultThreadFactory() |
Modifier and Type | Method and Description |
---|---|
WorkerTask |
createWorkerThread(String name,
WorkerTask task,
boolean daemon)
Creates a new thread of execution for the supplied task.
|
void |
setThreadJoinTimeout(long millis)
Sets the maximum time to wait when joining a worker task thread.
|
public WorkerTask createWorkerThread(String name, WorkerTask task, boolean daemon)
createWorkerThread
in interface ThreadFactory
name
- the name of the execution thread.task
- the task to be executed in the new thread.daemon
- indicates whether the new thread is a daemon (true
or an
user thread (false
).WorkerTask
wrapper to control start and
termination of the thread.public void setThreadJoinTimeout(long millis)
millis
- the time to wait. 0 waits forever.Copyright © 2014 SNMP4J.org. All rights reserved.