- java.lang.Object
-
- org.snmp4j.util.DefaultThreadFactory
-
- All Implemented Interfaces:
ThreadFactory
public class DefaultThreadFactory extends java.lang.Object implements ThreadFactory
TheDefaultThreadFactorycreatesWorkerTaskinstances 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 theWorkerTask.join()method. By setting- Since:
- 1.8
- Version:
- 1.10.2
- Author:
- Frank Fock
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classDefaultThreadFactory.WorkerThread
-
Constructor Summary
Constructors Constructor Description DefaultThreadFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WorkerTaskcreateWorkerThread(java.lang.String name, WorkerTask task, boolean daemon)Creates a new thread of execution for the supplied task.voidsetThreadJoinTimeout(long millis)Sets the maximum time to wait when joining a worker task thread.
-
-
-
Method Detail
-
createWorkerThread
public WorkerTask createWorkerThread(java.lang.String name, WorkerTask task, boolean daemon)
Creates a new thread of execution for the supplied task.- Specified by:
createWorkerThreadin interfaceThreadFactory- Parameters:
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 (trueor an user thread (false).- Returns:
- the
WorkerTaskwrapper to control start and termination of the thread.
-
setThreadJoinTimeout
public void setThreadJoinTimeout(long millis)
Sets the maximum time to wait when joining a worker task thread.- Parameters:
millis- the time to wait. 0 waits forever.- Since:
- 1.10.2
-
-