Skip to content

docs: clarify remaining capacity under concurrent producers - #516

Closed
许钊瑞 (xuzhaorui) wants to merge 1 commit into
LMAX-Exchange:masterfrom
xuzhaorui:docs/clarify-remaining-capacity-concurrency
Closed

许钊瑞 (xuzhaorui) wants to merge 1 commit into
LMAX-Exchange:masterfrom
xuzhaorui:docs/clarify-remaining-capacity-concurrency

Conversation

@xuzhaorui

Copy link
Copy Markdown

Summary

Clarifies the concurrency semantics of Sequenced.remainingCapacity() in response to #511.

The method does not provide an atomic capacity snapshot. Under concurrent producers, sequences may be reserved before they are published, and the estimate may be stale or negative while producers contend for a full buffer. The documentation now recommends hasAvailableCapacity(int) or tryNext() when a capacity decision must be correct.

This intentionally does not change the existing cursor-read order: as discussed in #511, reading the cursor once or twice has different consistency trade-offs, and neither option is universally preferable.

Validation

  • git diff --check passed.
  • Gradle tests could not be run locally because the Gradle 8.10 wrapper distribution download timed out in the environment.
  • No runtime behavior was changed; this is a Javadoc-only change.

Closes #511

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential inconsistency in MultiProducerSequencer.remainingCapacity(): cursor read twice

2 participants