Encapsulate ConcurrentHashtable.SizeManager and relocate createBounded - #12453
Draft
dougqh wants to merge 1 commit into
Draft
Encapsulate ConcurrentHashtable.SizeManager and relocate createBounded#12453dougqh wants to merge 1 commit into
dougqh wants to merge 1 commit into
Conversation
State.sizeManager was a public field, letting callers outside this class reach into SizeManager directly instead of going through the State-accepting static helpers. Narrow it to package-private and add the missing tryReserve(State) wrapper so external callers (e.g. an upcoming ConcurrentHashtable consumer) have a sanctioned lock-free reservation entry point instead of needing sizeManager exposed. Also move createBounded from the nested State class onto ConcurrentHashtable directly for a nicer call site, per review discussion on PR #12367. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Contributor
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Does This Do
Two small, uncontroversial
ConcurrentHashtableAPI cleanups surfaced during review of #12367 (the first real external consumer ofConcurrentHashtable):SizeManager.State.sizeManagerwas a public field, so a caller with aStatereference could reach intoSizeManagerdirectly instead of going through theState-accepting static helpers (estimateSize,isFull,tryReserveOrEvict,evictOne,evictAll). That's now package-private. It was also missing a lock-freetryReserve(State)wrapper — the one operation an external caller doing custom find/reserve/insert (likeLogCollectorin Use ConcurrentHashtable for telemetry log #12367) actually needs — so callers no longer have to bypass encapsulation just to call it.createBounded. Moved from the nestedConcurrentHashtable.State.createBounded(...)ontoConcurrentHashtable.createBounded(...)directly for a nicer call site.D1.createBounded/D2.createBoundednow delegate to it.Pure refactor — no behavior change. Existing tests updated only to call
ConcurrentHashtable.createBoundedinstead ofConcurrentHashtable.State.createBounded.Motivation
See the review thread on #12367 (comments from @dougqh):
These are the least controversial items from that discussion; a couple of other, more design-heavy follow-ups (a lock-free find/matcher primitive avoiding boxed composite keys, and a doc note on the
bucketAt/isFullcomposability hazard) are being tracked separately and are not part of this PR.Contributor Checklist
🤖 Generated with Claude Code