Skip to content

Clarify Windows memory-map file locking and fix Javadoc issues#401

Merged
horgh merged 6 commits into
mainfrom
greg/docs-windows-memory-map-lock
Jun 30, 2026
Merged

Clarify Windows memory-map file locking and fix Javadoc issues#401
horgh merged 6 commits into
mainfrom
greg/docs-windows-memory-map-lock

Conversation

@oschwald

@oschwald oschwald commented Jun 30, 2026

Copy link
Copy Markdown
Member

Documentation-only changes. Part of STF-865.

Windows memory-map file locking

Clarifies the "File Lock on Windows" section (README) and the FileMode / close() Javadoc:

  • The behavior is a live OS-level memory mapping, not a Java FileLock.
  • Closing the Reader releases this library's reference, but Java provides no supported way to unmap a MappedByteBuffer immediately — the mapping is released only when the buffer is garbage collected.
  • Outstanding lookups and Networks iterators hold duplicate buffers (BufferHolder.get() returns buffer.duplicate()), which also keep the mapping alive. The guidance now tells users to drop those references too.
  • Corrected the enum name MEMORY_MAPMEMORY_MAPPED in the README (it never matched the actual enum constant).

Other doc fixes (from a scan of the rest of the docs)

  • Reader.java typos: HastMapHashMap and databaseddatabase (3 occurrences each).
  • CHMCache.java: the CHMCache(int) Javadoc claimed the cache evicts entries at capacity. There is no eviction policy — the cache stops accepting new entries once full (matches the class-level Javadoc and the implementation).

The companion GeoIP2-java doc fixes are in a separate PR (also under STF-865).

Note: the mise.lock update was already on this branch; it is unrelated tooling and can be split out if preferred.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Clarified Reader file mode behavior, including the default memory-mapped option and how it affects file availability on Windows.
    • Updated guidance on closing readers and iterators before replacing a database file.
    • Refined cache documentation to explain that it stops accepting new entries at maximum capacity.
    • Improved API docs wording and parameter/exception descriptions for network iteration methods.

oschwald and others added 4 commits June 29, 2026 20:14
Correct "HastMap" -> "HashMap" and "databased" -> "database" in the
get(), getRecord(), and networks() Javadoc.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The CHMCache(int) parameter doc claimed the cache evicts entries once
capacity is reached. There is no eviction policy: as the class-level
Javadoc and the implementation show, the cache simply stops accepting
new entries once it is full.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@oschwald, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 42 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 93cbe71c-a170-47a2-90bd-595573927d86

📥 Commits

Reviewing files that changed from the base of the PR and between 52449bd and bcd7d74.

📒 Files selected for processing (2)
  • lychee.toml
  • src/main/java/com/maxmind/db/Networks.java
📝 Walkthrough

Walkthrough

Documentation-only updates across README and Javadoc: renames MEMORY_MAP to MEMORY_MAPPED, rewrites Windows file-lock guidance, corrects CHMCache capacity description, fixes typos, and revises @throws/@param entries for Reader methods.

Changes

Documentation Clarifications

Layer / File(s) Summary
README FileMode and Windows guidance
README.md
Updates FileMode option name to MEMORY_MAPPED, rewrites the Windows file-lock section to describe mapped-buffer GC behavior, and documents the MEMORY mode workaround.
Javadoc updates
src/main/java/com/maxmind/db/Reader.java, src/main/java/com/maxmind/db/CHMCache.java
Expands FileMode.MEMORY_MAPPED Windows platform notes, changes CHMCache capacity wording from eviction to halting, fixes typos and revises @throws/@param for networks, networksWithin, and close.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐇 A rabbit renames a map with care,
MEMORY_MAPPED floats through the air.
Windows won't lock, GC sets it free,
Docs now shine bright for all to see.
Hop along, reader — clarity's there! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main documentation changes around Windows memory-mapped locking and Javadoc fixes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch greg/docs-windows-memory-map-lock

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates documentation and Javadocs to clarify the behavior of the MEMORY_MAPPED file mode on Windows and corrects several typos. It also updates various tool versions in the mise.lock file. Feedback is provided regarding an incorrect domain name change in the auto-generated comment of the lockfile.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread mise.lock
@@ -1,94 +1,104 @@
# @generated - this file is auto-generated by `mise lock` https://mise.jdx.dev/dev-tools/mise-lock.html
# @generated - this file is auto-generated by `mise lock` https://mise.en.dev/dev-tools/mise-lock.html

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The domain in the auto-generated comment has been changed to mise.en.dev, but the official domain for the mise tool is mise.jdx.dev. Please revert this to https://mise.jdx.dev/dev-tools/mise-lock.html.

oschwald and others added 2 commits June 30, 2026 14:41
The next() Javadoc referred to "DataRecord"; the method returns
DatabaseRecord.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@oschwald oschwald force-pushed the greg/docs-windows-memory-map-lock branch from e377b79 to bcd7d74 Compare June 30, 2026 15:01
@horgh horgh merged commit 78bd2d3 into main Jun 30, 2026
30 checks passed
@horgh horgh deleted the greg/docs-windows-memory-map-lock branch June 30, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants