java.lang.Object
edu.emory.mathcs.util.concurrent.PlainThreadFactory
- All Implemented Interfaces:
- ThreadFactory
- public class PlainThreadFactory
- extends java.lang.Object
- implements ThreadFactory
Thread factory implementation that attempts to ensure that created threads
are equivalent regardless of threads that request creation. Precisely,
created threads belong to the same thread group, and they inherit a
"parent thread context" (access control context,
DelegatableThreadLocals, etc.) from the factory creator rather than
from the invoker of newThread(java.lang.Runnable)
55 .
This thread factory is used as a default for PooledExecutor, as it
guarantees deterministic behavior and minimal security properties.
Nevertheless, stronger semantics are often neccessary in
security-sensitive applications. In particular,
it may be required that worker tasks run within access control context and
with delegatable locals of the thread that scheduled the task, which
may generally be distinct from both the thread pool creator and the worker
thread creator. If such security semantics is needed, use
SecurePooledExecutor.
- Version:
- 1.0
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
acc
final java.security.AccessControlContext acc
group
final java.lang.ThreadGroup group
tc
final ThreadContext tc
name
final java.lang.String name
idx
int idx
PlainThreadFactory
public PlainThreadFactory()
- Creates a new tread factory that creates threads within a default
thread group. The group of the current thread (invoking this
constructor) is used as a default unless explicitly overridden
by current security manager.
PlainThreadFactory
public PlainThreadFactory(java.lang.String name)
- Creates a new tread factory that uses default thread group and
specified thread name prefix. The group of the current thread (invoking
this constructor) is used as a default unless explicitly overridden
by current security manager.
PlainThreadFactory
public PlainThreadFactory(java.lang.ThreadGroup group)
- Creates a new tread factory that creates threads within the specified
thread group.
PlainThreadFactory
public PlainThreadFactory(java.lang.ThreadGroup group,
java.lang.String name)
- Creates a new tread factory that creates threads within the specified
thread group, and uses specified thread name prefix.
newThread
public java.lang.Thread newThread(java.lang.Runnable command)
- Description copied from interface:
ThreadFactory
- Create a new thread that will run the given command when started
- Specified by:
newThread
in interface ThreadFactory
getNextIdx
private int getNextIdx()