code: public void runWith(T value, Runnable doRun) {
          WeakReference<Holder> ref = local.get();
          Holder holder = ref != null ? ref.get() : createHolder();
          Object oldValue = holder.value;
          holder.value = value;
          try {
              doRun.run();
          } finally {
              holder.value = oldValue;
          }
      }
docs: Executes task with thread-local set to the specified value. The state is restored however the task exits. If
  uninitialised before running the task, it will remain so upon exiting. Setting the thread-local within the task
  does not affect the state after exitign.