java.lang.Object
org.refcodes.controlflow.TweakableThreadFactory
- All Implemented Interfaces:
ThreadFactory
The
TweakableThreadFactory implements the ThreadFactory to be
used by an ExecutorService. The TweakableThreadFactory is
providing additional means to set the priority of a Thread or whether
a Thread is being executed as a daemon Thread so that the
IllegalThreadStateException instances can be configured as required
when being executed by an ExecutorService.
Else there would be no means force Thread instances to be executed as
daemons or with a required priority when executed by the
ExecutorService without such a dedicated ThreadFactory.
-
Constructor Summary
ConstructorsConstructorDescriptionTweakableThreadFactory(boolean isDaemon) Constructs theTweakableThreadFactorywith the given attributes.TweakableThreadFactory(int aPriority) Constructs theTweakableThreadFactorywith the given attributes.TweakableThreadFactory(int aPriority, boolean isDaemon) Constructs theTweakableThreadFactorywith the given attributes. -
Method Summary
-
Constructor Details
-
TweakableThreadFactory
public TweakableThreadFactory(int aPriority, boolean isDaemon) Constructs theTweakableThreadFactorywith the given attributes.- Parameters:
aPriority- The priority to set for the treadsisDaemon- True in case the threads are to be executed as daemon threads.
-
TweakableThreadFactory
public TweakableThreadFactory(int aPriority) Constructs theTweakableThreadFactorywith the given attributes.- Parameters:
aPriority- The priority to set for the treads
-
TweakableThreadFactory
public TweakableThreadFactory(boolean isDaemon) Constructs theTweakableThreadFactorywith the given attributes.- Parameters:
isDaemon- True in case the threads are to be executed as daemon threads.
-
-
Method Details
-
newThread
- Specified by:
newThreadin interfaceThreadFactory
-