Skip to content
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

Merged
merged 3 commits into from
Dec 14, 2023

Conversation

lorban
Copy link
Contributor

@lorban lorban commented Dec 11, 2023

Clean the ConcurrentPool.dump() output by including omitted data and removing duplicated data.

@lorban lorban added this to the 12.0.x milestone Dec 11, 2023
@lorban lorban self-assigned this Dec 11, 2023
joakime
joakime previously approved these changes Dec 11, 2023
Copy link
Contributor

@joakime joakime left a 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);
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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);

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor

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.

@lorban lorban requested a review from sbordet December 12, 2023 10:21
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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);
Copy link
Contributor

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]>
sbordet
sbordet previously approved these changes Dec 12, 2023
Copy link
Contributor

@gregw gregw left a 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

@gregw
Copy link
Contributor

gregw commented Dec 12, 2023

@lorban @sbordet how about renaming hold & free to released & acquired, as that is the terminology used in the javadoc to explain the methods?

Signed-off-by: Ludovic Orban <[email protected]>
@sbordet sbordet merged commit d974c4d into jetty-12.0.x Dec 14, 2023
8 checks passed
@sbordet sbordet deleted the fix/jetty-12-improve-ConcurrentPool-dump branch December 14, 2023 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants