TL;DR: Spring’s request scope lives in ThreadLocal—and that means any child threads you spin up start with empty pockets. No automatic inheritance, no magic fairy dust. Manually shuttle your context or resign yourself to errors and leaks. ## Why Request Scope and ThreadLocal Are BFFs—Until They’re Not Spring binds HTTP requests to threads via ThreadLocal. Great for simple, single-thread request handling, lousy when you fire off @Async tasks, ExecutorService jobs, or parallel streams. Those child threads? They see a blank ThreadLocal and throw “Scope ‘request’ is not active” errors. ## The Manual Propagation Dance Copy before you submit: grab RequestContextHolder.currentRequestAttributes() in the parent, pass it into your Runnable or Callable, then call RequestContextHolder.setRequestAttributes() in the child. Yes, you also need to clear it afterward. Forget and watch old contexts pile up in your thread pool like uncollected baggage. ## The New Hope in Java 20+: ScopedValue ScopedValue gives us block-scoped, immutable context that travels in a controlled way and cleans up when the block ends. Cooler than a ThreadLocal, but Spring hasn’t fully embraced it. Keep an eye on this space—it might save your club some headaches. So, do you double down on manual propagation or wait for ScopedValue adoption? The Mutex Club awaits your decision.
The Mutex Club: Taming the CAS Retry Storm
Introduction # The Brutal Truth CAS (Compare-and-Swap) is the heavy hammer in your concurrency toolbox: atomic, efficient, and surprisingly…