Class ThreadLocalsRunnable

  • All Implemented Interfaces:
    Runnable

    public class ThreadLocalsRunnable
    extends Object
    implements Runnable
    Copies any number of ThreadLocal values from the current thread onto the thread that runs the provided runnable.
    See Also:
    ThreadLocal
    • Constructor Detail

      • ThreadLocalsRunnable

        public ThreadLocalsRunnable​(Runnable task,
                                    ThreadLocal<?>... threadLocals)
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface Runnable