Skip to content

docs: align double-checked-locking README with actual Inventory implementation - #3623

Open
1wu-davy-2 wants to merge 1 commit into
iluwatar:masterfrom
1wu-davy-2:docs/fix-double-checked-locking-readme
Open

1wu-davy-2 wants to merge 1 commit into
iluwatar:masterfrom
1wu-davy-2:docs/fix-double-checked-locking-readme

Conversation

@1wu-davy-2

Copy link
Copy Markdown

Description

README previously described non-existent HolderThreadSafe and Heavy classes; updated to match the real Inventory + ReentrantLock implementation.

The "Programmatic Example" section now documents the actual double-checked locking logic in Inventory.addItem(), where the inventory size is checked once before acquiring the lock and once again inside the locked section.

Checklist

  • Only documentation change (double-checked-locking/README.md)
  • Code snippets verified against Inventory.java
  • No remaining references to HolderThreadSafe or Heavy

Assisted by AI tools for initial analysis; all changes manually verified and tested.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

PR Summary

Aligned the double-checked locking README with the actual Inventory implementation. Replaced references to non-existent HolderThreadSafe/Heavy with the Inventory class and its ReentrantLock-based addItem logic. The Programmatic Example now documents the real double-checked locking flow: first a capacity check, then acquiring the lock, then a second capacity check inside the locked section, and adding an item. Updated class name and fields accordingly.

Changes

File Summary
double-checked-locking/README.md Documentation updated to reflect the Inventory class and its locking behavior. Replaced HolderThreadSafe/Heavy references with Inventory and Lock usage; the programmatic example now shows: first items.size() < inventorySize check, then lock.lock() and a second check inside the critical section, adding the item if room, and unlocking. Also demonstrates the Inventory constructor and addItem(Item) return value.

autogenerated by presubmit.ai

@github-actions github-actions 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.

✅ LGTM!

Review Summary

Commits Considered (1)
  • b2aaa4a: docs: align double-checked-locking README with actual Inventory implementation
Files Processed (1)
  • double-checked-locking/README.md (1 hunk)
Actionable Comments (0)
Skipped Comments (2)
  • double-checked-locking/README.md [43-45]

    readability: "Clarify terminology for the two-phase check"

  • double-checked-locking/README.md [57-59]

    maintainability: "Unprotected first check may lead to data races"

@codecov

codecov Bot commented Oct 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.99%. Comparing base (4cabb20) to head (b2aaa4a).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3623      +/-   ##
============================================
- Coverage     84.06%   83.99%   -0.08%     
+ Complexity     4353     4347       -6     
============================================
  Files          1133     1133              
  Lines         15400    15400              
  Branches        739      739              
============================================
- Hits          12946    12935      -11     
- Misses         2158     2164       +6     
- Partials        296      301       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

1 participant