Package pl.morgwai.base.guice.scopes
Class ContextTrackingExecutor.NamedThreadFactory
- java.lang.Object
-
- pl.morgwai.base.guice.scopes.ContextTrackingExecutor.NamedThreadFactory
-
- All Implemented Interfaces:
ThreadFactory
- Enclosing class:
- ContextTrackingExecutor
public static class ContextTrackingExecutor.NamedThreadFactory extends Object implements ThreadFactory
A thread factory that names new threads based on its own name. Each instance has an associated thread group (named after itself), which newly created threads will belong to. All such instance associated thread groups have a common parent (named "ContextTrackingExecutors"), which in turn is a child of the system default thread group (obtained from system security manager under normal circumstances).
-
-
Field Summary
Fields Modifier and Type Field Description static String
PARENT_THREAD_GROUP_NAME
Name of the parent of all thread groups associated withContextTrackingExecutor
instances.
-
Constructor Summary
Constructors Constructor Description NamedThreadFactory(String name)
Constructs a factory that will assignThread.NORM_PRIORITY
to created threads.NamedThreadFactory(String name, int priority)
Constructs a factory that will assignpriority
to created threads.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Thread
newThread(Runnable task)
Creates a new thread named<thisFactoryName>-thread-<sequenceNumber>
.
-
-
-
Field Detail
-
PARENT_THREAD_GROUP_NAME
public static final String PARENT_THREAD_GROUP_NAME
Name of the parent of all thread groups associated withContextTrackingExecutor
instances.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NamedThreadFactory
public NamedThreadFactory(String name)
Constructs a factory that will assignThread.NORM_PRIORITY
to created threads.
-
NamedThreadFactory
public NamedThreadFactory(String name, int priority)
Constructs a factory that will assignpriority
to created threads.
-
-
Method Detail
-
newThread
public Thread newThread(Runnable task)
Creates a new thread named<thisFactoryName>-thread-<sequenceNumber>
.- Specified by:
newThread
in interfaceThreadFactory
-
-