Package io.netty.util.concurrent
Class FastThreadLocalThread
java.lang.Object
java.lang.Thread
io.netty.util.concurrent.FastThreadLocalThread
- All Implemented Interfaces:
Runnable
A special
Thread
that provides fast access to FastThreadLocal
variables.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final boolean
private static final InternalLogger
private InternalThreadLocalMap
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionFastThreadLocalThread
(Runnable target) FastThreadLocalThread
(Runnable target, String name) FastThreadLocalThread
(String name) FastThreadLocalThread
(ThreadGroup group, Runnable target) FastThreadLocalThread
(ThreadGroup group, Runnable target, String name) FastThreadLocalThread
(ThreadGroup group, Runnable target, String name, long stackSize) FastThreadLocalThread
(ThreadGroup group, String name) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Query whether this thread is allowed to perform blocking calls or not.final void
setThreadLocalMap
(InternalThreadLocalMap threadLocalMap) Sets the internal data structure that keeps the thread-local variables bound to this thread.final InternalThreadLocalMap
Returns the internal data structure that keeps the thread-local variables bound to this thread.boolean
static boolean
willCleanupFastThreadLocals
(Thread thread) Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
logger
-
cleanupFastThreadLocals
private final boolean cleanupFastThreadLocals -
threadLocalMap
-
-
Constructor Details
-
FastThreadLocalThread
public FastThreadLocalThread() -
FastThreadLocalThread
-
FastThreadLocalThread
-
FastThreadLocalThread
-
FastThreadLocalThread
-
FastThreadLocalThread
-
FastThreadLocalThread
-
FastThreadLocalThread
-
-
Method Details
-
threadLocalMap
Returns the internal data structure that keeps the thread-local variables bound to this thread. Note that this method is for internal use only, and thus is subject to change at any time. -
setThreadLocalMap
Sets the internal data structure that keeps the thread-local variables bound to this thread. Note that this method is for internal use only, and thus is subject to change at any time. -
willCleanupFastThreadLocals
-
willCleanupFastThreadLocals
-
permitBlockingCalls
public boolean permitBlockingCalls()Query whether this thread is allowed to perform blocking calls or not.FastThreadLocalThread
s are often used in event-loops, where blocking calls are forbidden in order to prevent event-loop stalls, so this method returnsfalse
by default.Subclasses of
FastThreadLocalThread
can override this method if they are not meant to be used for running event-loops.- Returns:
false
, unless overriden by a subclass.
-