Class FastThreadLocalThread

java.lang.Object
java.lang.Thread
io.netty.util.concurrent.FastThreadLocalThread
All Implemented Interfaces:
Runnable

public class FastThreadLocalThread extends Thread
A special Thread that provides fast access to FastThreadLocal variables.
  • Field Details

    • logger

      private static final InternalLogger logger
    • cleanupFastThreadLocals

      private final boolean cleanupFastThreadLocals
    • threadLocalMap

      private InternalThreadLocalMap threadLocalMap
  • Constructor Details

    • FastThreadLocalThread

      public FastThreadLocalThread()
    • FastThreadLocalThread

      public FastThreadLocalThread(Runnable target)
    • FastThreadLocalThread

      public FastThreadLocalThread(ThreadGroup group, Runnable target)
    • FastThreadLocalThread

      public FastThreadLocalThread(String name)
    • FastThreadLocalThread

      public FastThreadLocalThread(ThreadGroup group, String name)
    • FastThreadLocalThread

      public FastThreadLocalThread(Runnable target, String name)
    • FastThreadLocalThread

      public FastThreadLocalThread(ThreadGroup group, Runnable target, String name)
    • FastThreadLocalThread

      public FastThreadLocalThread(ThreadGroup group, Runnable target, String name, long stackSize)
  • Method Details

    • threadLocalMap

      public final InternalThreadLocalMap 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

      public final void setThreadLocalMap(InternalThreadLocalMap threadLocalMap)
      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

      public boolean willCleanupFastThreadLocals()
      Returns true if FastThreadLocal.removeAll() will be called once Thread.run() completes.
    • willCleanupFastThreadLocals

      public static boolean willCleanupFastThreadLocals(Thread thread)
      Returns true if FastThreadLocal.removeAll() will be called once Thread.run() completes.
    • permitBlockingCalls

      public boolean permitBlockingCalls()
      Query whether this thread is allowed to perform blocking calls or not. FastThreadLocalThreads are often used in event-loops, where blocking calls are forbidden in order to prevent event-loop stalls, so this method returns false 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.