public class NamedThreadFactory
extends java.lang.Object
implements java.util.concurrent.ThreadFactory
Modifier and Type | Field and Description |
---|---|
java.lang.String |
id |
protected java.util.concurrent.atomic.AtomicInteger |
n |
Constructor and Description |
---|
NamedThreadFactory(java.lang.String id) |
NamedThreadFactory(java.lang.String id,
int priority) |
NamedThreadFactory(java.lang.String id,
int priority,
java.lang.ClassLoader contextClassLoader,
java.lang.ThreadGroup threadGroup) |
Modifier and Type | Method and Description |
---|---|
java.lang.Thread |
newThread(java.lang.Runnable runnable) |
static java.lang.Runnable |
threadLocalDeallocator(java.lang.Runnable r)
Ensures that
FastThreadLocal.remove() is called when the Runnable.run()
method of the given Runnable instance completes to ensure cleanup of FastThreadLocal instances. |
public final java.lang.String id
protected final java.util.concurrent.atomic.AtomicInteger n
public NamedThreadFactory(java.lang.String id)
public NamedThreadFactory(java.lang.String id, int priority)
public NamedThreadFactory(java.lang.String id, int priority, java.lang.ClassLoader contextClassLoader, java.lang.ThreadGroup threadGroup)
public java.lang.Thread newThread(java.lang.Runnable runnable)
newThread
in interface java.util.concurrent.ThreadFactory
public static java.lang.Runnable threadLocalDeallocator(java.lang.Runnable r)
FastThreadLocal.remove()
is called when the Runnable.run()
method of the given Runnable
instance completes to ensure cleanup of FastThreadLocal
instances.
This is especially important for direct byte buffers allocated locally for a thread.Copyright © 2017 The Apache Software Foundation