Package org.refcodes.controlflow
Class ThreadFactoryImpl
- java.lang.Object
-
- org.refcodes.controlflow.ThreadFactoryImpl
-
- All Implemented Interfaces:
java.util.concurrent.ThreadFactory
public class ThreadFactoryImpl extends java.lang.Object implements java.util.concurrent.ThreadFactory
TheThreadFactoryImpl
implements theThreadFactory
to be used by anExecutorService
. TheThreadFactoryImpl
is providing additional means to set the priority of a thread or whether a is being executed as a daemon thread; so that the threads can be configured as required when being executed by anExecutorService
.Else there would be no means force threads to be executed as daemon threads or with a required priority when executed by the
ExecutorService
without such a dedicatedThreadFactory
.
-
-
Constructor Summary
Constructors Constructor Description ThreadFactoryImpl(boolean isDaemon)
Constructs theThreadFactoryImpl
with the given attributes.ThreadFactoryImpl(int aPriority)
Constructs theThreadFactoryImpl
with the given attributes.ThreadFactoryImpl(int aPriority, boolean isDaemon)
Constructs theThreadFactoryImpl
with the given attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Thread
newThread(java.lang.Runnable aRunnable)
-
-
-
Constructor Detail
-
ThreadFactoryImpl
public ThreadFactoryImpl(int aPriority, boolean isDaemon)
Constructs theThreadFactoryImpl
with the given attributes.- Parameters:
aPriority
- The priority to to set for the treadsisDaemon
- True in case the threads are to be executed as daemon threads.
-
ThreadFactoryImpl
public ThreadFactoryImpl(int aPriority)
Constructs theThreadFactoryImpl
with the given attributes.- Parameters:
aPriority
- The priority to to set for the treads
-
ThreadFactoryImpl
public ThreadFactoryImpl(boolean isDaemon)
Constructs theThreadFactoryImpl
with the given attributes.- Parameters:
isDaemon
- True in case the threads are to be executed as daemon threads.
-
-