'If you use ThreadContext.put() in a Runnable, do you still need to remove the element you added after execution?
I'm trying to set up log4j to print certain values in all log messages.
I'm reading that if you add a value via ThreadContext.put() (a traceId in this case) in a class, then use an executor service to start a Runnable I need to add the traceId to the ThreadContext in the runnable too (unless I modify some config to automatically do that, I haven't looked into that yet).
My question is, when that Runnable terminates, is the ThreadContext it was using destroyed, or do I need to manually delete the value I added before it's disposed of?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
