code: public static <V> Callable<V> withMDC(Callable<V> r) {
      return new Callable<V>() {
  
        private final Map<String, String> contextMap = safeCopyOfContextMap();
  
        @Override
        public V call() throws Exception {
          safeSetContextMap(contextMap);
          try {
            return r.call();
          } finally {
            safeResetContextMap();
          }
        }
      };
    }
docs: Wrap a {@link Callable} to use the {@link MDC} from the calling thread.