Replies: 1 comment
-
Wouldn't it be better to handle MDC cleanup in filter / interceptor classes, in order to avoid repeating those finally blocks ? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Why?
The MDC usage requires a deep understanding of how it works and gives additional side effects that might not be transparent for regular java developers
thus, MDC thread-local variables should be cleaned within the same method
Even, if people know how MDC works/are aware, they might forget to clean in another place in a project or due to staff turnover (which is common in our industry) newcomers might not aware and may make mistakes.
Beta Was this translation helpful? Give feedback.
All reactions