A pooled thread outlives the request that set the value. The next task on that thread inherits it - so the entry never becomes garbage, and one user's tenant or principal is read by another user's request.
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-08-25