Class ThreadLocals

    • Constructor Detail

      • ThreadLocals

        private ThreadLocals()
    • Method Detail

      • let

        public static <T> void let​(ThreadLocal<T> threadLocal,
                                   T value,
                                   Runnable runnable)
        Performs an action with a thread-local set to a particular value.
      • let

        public static <T,​R> R let​(ThreadLocal<T> threadLocal,
                                        T value,
                                        Supplier<R> supplier)
        Performs an action with a thread-local set to a particular value, and returns the result.
      • mutate

        public static <T> void mutate​(ThreadLocal<T> threadLocal,
                                      UnaryOperator<T> transform,
                                      Runnable runnable)
        Performs an action with a thread-local set to a value derived from its current value via a transformer.
      • mutate

        public static <T,​R> R mutate​(ThreadLocal<T> threadLocal,
                                           UnaryOperator<T> transform,
                                           Supplier<R> supplier)
        Performs an action with a thread-local set to a value derived from its current value via a transformer, and returns the result.