Skip to content

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

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#733
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. Companion to maxmind/MaxMind-DB-Reader-java#401.

Windows memory-map file locking

The underlying DatabaseReader.close() delegates to the maxmind-db Reader, so it has the same Windows memory-map behavior. This:

  • Rewrites the stale DatabaseReader.close() Javadoc. The old text described it as a MappedByteBuffer limitation that simply nulled the reference; the new text explains Java provides no supported way to unmap immediately and that on Windows the file may stay locked for rename/replace/delete until the buffer is garbage collected.
  • Adds a "File Lock on Windows" section to the README, which previously had none.

Javadoc accuracy fixes (from a scan of the rest of the docs)

  • Corrected @return tags naming nonexistent/wrong types in DatabaseReader and DatabaseProvider:
    • ConnectTypeResponseConnectionTypeResponse (×3)
    • IPRiskResponseIpRiskResponse (×2)
    • IspResponseAsnResponse on the GeoLite ASN lookup methods (×2)
  • fileMode() Javadoc referred to initializing the Builder "with a URL" — it is an InputStream.
  • Removed stray return-value text ("or empty if it is not in the DB") from a tryIsp() @param description.

mvn checkstyle:check passes.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Expanded the README’s database usage guidance with a new note about file locking on Windows when using memory-mapped mode.
    • Clarified how to avoid replacement/deletion issues by using in-memory mode or closing the database reader before replacing the file.
    • Improved and corrected Javadoc across the public API (grammar, consistent “empty if not in the DB” wording, and return/enum type references), including minor formatting fixes.

oschwald and others added 2 commits June 30, 2026 14:31
Rewrite the DatabaseReader.close() Javadoc to explain that closing the
reader releases its reference to the mapped buffer but cannot unmap the
MappedByteBuffer immediately, and that on Windows this may keep the
database file locked for rename, replacement, or deletion until the
buffer is garbage collected. Also add a "File Lock on Windows" section
to the README, which previously had none.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Correct several @return tags that named nonexistent or wrong types:
ConnectTypeResponse -> ConnectionTypeResponse, IPRiskResponse ->
IpRiskResponse, and IspResponse -> AsnResponse on the GeoLite ASN
lookup methods. Also fix the fileMode() Javadoc, which referred to
initializing the Builder with a URL rather than an InputStream, and
remove stray return-value text from a tryIsp() @param description.

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: 20 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: 19bd5f2c-9281-494d-8963-06d9bac61179

📥 Commits

Reviewing files that changed from the base of the PR and between d56d6ba and acdb7fd.

⛔ Files ignored due to path filters (1)
  • mise.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • lychee.toml
📝 Walkthrough

Walkthrough

Javadoc fixes across DatabaseProvider and DatabaseReader correct return-type names and parameter text, reword close() and fileMode() documentation, and add a Windows file-lock note to the README. One malformed Javadoc code tag is also corrected.

Changes

Documentation and Javadoc fixes

Layer / File(s) Summary
DatabaseReader and README behavior notes
src/main/java/com/maxmind/geoip2/DatabaseReader.java, README.md
Rewords fileMode() and close() Javadoc to describe the InputStream/FileMode.MEMORY mismatch and mapped-buffer release on Windows, and adds README guidance for MEMORY_MAPPED file-lock behavior.
API Javadoc wording corrections
src/main/java/com/maxmind/geoip2/DatabaseProvider.java, src/main/java/com/maxmind/geoip2/WebServiceClient.java, src/main/java/com/maxmind/geoip2/WebServiceProvider.java, src/main/java/com/maxmind/geoip2/NetworkDeserializer.java, src/main/java/com/maxmind/geoip2/model/ConnectionTypeResponse.java
Corrects return-type names, pluralization, optional-return wording, parameter text, and one inline code tag across public API Javadoc.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 I hopped through docs with a careful nose,
Fixed Javadocs where the wording froze.
The README gleams with a Windows light,
And mapped buffers behave a bit more bright.
Hop hop hooray, the notes read true!

🚥 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: Windows memory-map file locking clarification and Javadoc fixes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 the documentation in README.md and Javadocs across DatabaseProvider.java and DatabaseReader.java. It adds a section explaining file locking behavior on Windows when using memory-mapped files, corrects several class name references in Javadocs (such as changing IPRiskResponse to IpRiskResponse and ConnectTypeResponse to ConnectionTypeResponse), and clarifies the builder's file mode behavior. The reviewer suggested updating the Javadoc for the isp method to maintain consistency with other methods, although care should be taken as isp returns a direct response rather than an Optional.

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.

* Look up an IP address in a GeoIP ISP database.
*
* @param ipAddress IPv4 or IPv6 address to look up or empty if it is not in the DB.
* @param ipAddress IPv4 or IPv6 address to look up.

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

While removing the misplaced "or empty if it is not in the DB" from the @param tag is correct, this phrase should be added to the @return tag on line 211 to maintain consistency with the other try* methods in this interface (such as tryCountry, tryCity, tryAsn, etc.) which return an Optional.\n\nCurrently, line 211 reads:\njava\n * @return an IspResponse for the requested IP address.\n\nIt should be updated to:\njava\n * @return an IspResponse for the requested IP address or empty if it is not in the DB.\n

oschwald and others added 4 commits June 30, 2026 14:43
- ConnectionTypeResponse.fromString() Javadoc said it creates a
  ConnectionTypeResponse; it returns the ConnectionType enum.
- NetworkDeserializer constructor Javadoc had a malformed inline tag
  (@{code instead of {@code).
- WebServiceProvider/WebServiceClient insights() @return said
  "Insight model" rather than "Insights model".
- Corrected "a AnonymousIpResponse"/"a AnonymousPlusResponse" to
  "an ..." in DatabaseProvider and DatabaseReader Javadoc.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
tryIsp returns Optional<IspResponse>, so its @return should note the
empty case like the other try* methods. The phrase had been misplaced
on the @param tag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@horgh horgh merged commit 914767e into main Jun 30, 2026
30 checks passed
@horgh horgh deleted the greg/docs-windows-memory-map-lock branch June 30, 2026 18:12
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