-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Improve the dump output of ConcurrentPool #11036
Improve the dump output of ConcurrentPool #11036
Conversation
Signed-off-by: Ludovic Orban <[email protected]>
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.
Simple enough.
return "%s@%x{%s,%s}".formatted(this.getClass().getSimpleName(), hashCode(), _weak.get(), _strong); | ||
ConcurrentEntry<P> weakEntry = _weak.get(); | ||
ConcurrentEntry<P> strongEntry = _strong; | ||
return "%s@%x{w=%s,s=%s,e=%s}".formatted(this.getClass().getSimpleName(), hashCode(), weakEntry == null ? "null" : "non-null", strongEntry == null ? "null" : "non-null", weakEntry); |
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.
Why this "null"/"non-null"?
Just print the weak and strong entries.
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.
No, because when an entry is at rest, both the weak and strong refs are non-null, so we'd print the same info twice. This is what we currently do and it makes the dump slightly confusing.
This is why I've changed the string to specify which ref is null or not (the info we need to troubleshoot weak/strong refs) plus the entry itself, to improve clarity.
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.
return "%s@%x{w=%s,s=%s,e=%s}".formatted(this.getClass().getSimpleName(), hashCode(), weakEntry == null ? "null" : "non-null", strongEntry == null ? "null" : "non-null", weakEntry); | |
return "%s@%x{%s,%s}".formatted(this.getClass().getSimpleName(), hashCode(), weakEntry, strongEntry == null ? "free" : "held", weakEntry); |
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 don't mind this change. @sbordet would you be happy with it?
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.
@lorban I don't like "free"/"held" (never did), so I'd prefer "acquired"/"idle" respectively (I want to know if the entry has been acquired, and "free" does not tell me that).
Also, the suggestion uses 4 parameters, but 5 arguments.
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.
@sbordet But the methods are called hold and free. We never agreed on better names so changing them to something else in the dump is just confusing.
The names have to match the methods. Ok to rename methods.. but idle really doesn't convey the same meaning as hold.
return "%s@%x{%s,%s}".formatted(this.getClass().getSimpleName(), hashCode(), _weak.get(), _strong); | ||
ConcurrentEntry<P> weakEntry = _weak.get(); | ||
ConcurrentEntry<P> strongEntry = _strong; | ||
return "%s@%x{w=%s,s=%s,e=%s}".formatted(this.getClass().getSimpleName(), hashCode(), weakEntry == null ? "null" : "non-null", strongEntry == null ? "null" : "non-null", weakEntry); |
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.
return "%s@%x{w=%s,s=%s,e=%s}".formatted(this.getClass().getSimpleName(), hashCode(), weakEntry == null ? "null" : "non-null", strongEntry == null ? "null" : "non-null", weakEntry); | |
return "%s@%x{%s,%s}".formatted(this.getClass().getSimpleName(), hashCode(), weakEntry, strongEntry == null ? "free" : "held", weakEntry); |
return "%s@%x{%s,%s}".formatted(this.getClass().getSimpleName(), hashCode(), _weak.get(), _strong); | ||
ConcurrentEntry<P> weakEntry = _weak.get(); | ||
ConcurrentEntry<P> strongEntry = _strong; | ||
return "%s@%x{w=%s,s=%s,e=%s}".formatted(this.getClass().getSimpleName(), hashCode(), weakEntry == null ? "null" : "non-null", strongEntry == null ? "null" : "non-null", weakEntry); |
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.
@lorban I don't like "free"/"held" (never did), so I'd prefer "acquired"/"idle" respectively (I want to know if the entry has been acquired, and "free" does not tell me that).
Also, the suggestion uses 4 parameters, but 5 arguments.
Signed-off-by: Ludovic Orban <[email protected]>
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.
Sorry but names need to match methods. If hold/free are not ok for dump they are not ok for method names.
It is just confusing to introduce different naming in dump only
Signed-off-by: Ludovic Orban <[email protected]>
Clean the
ConcurrentPool.dump()
output by including omitted data and removing duplicated data.