-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[36] Override the ThreadContextMap in the provider. #37
Conversation
Looks pretty good to me. Just two remarks:
|
@Override | ||
public boolean isEmpty() { | ||
// TODO (jrp) this is not fast and should be thought about, should we add this to the log managers MDC? | ||
return MDC.copy().isEmpty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest that we consider adding an MDC.isEmpty
query method to avoid the overhead of the copy in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, I filed https://issues.redhat.com/browse/LOGMGR-327 and will send up a PR.
I just recognized, that previously it was ok to call |
I think we can safely treat this case equivalently to |
@Override | ||
public Map<String, String> getImmutableMapOrNull() { | ||
final Map<String, String> copy = MDC.copy(); | ||
return copy.isEmpty() ? null : Collections.unmodifiableMap(copy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use Map.copyOf(copy)
. This way, if we ever change MDC.copy()
to return an immutable map, this won't actually have to make a copy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we just need to require Java 11 first. We're currently targeting Java 8.
9473d68
to
ccf8518
Compare
I changed the approach on this since we're going to do this requiring JBoss Log Manager 3.x. I've implemented a |
Never mind, this new approach only works if the |
resolves jboss-logging#36 Signed-off-by: James R. Perkins <[email protected]>
resolves #36