Tighten provider bootstrap, du//proc handling and add quality+architecture docs
#79
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.
More robust
duhelper inPosixAPIPosixAPI.du(String filename)now:InputStreamReaderwithStandardCharsets.UTF_8instead of the platform default.duproduces at least one line of output; if not, it throws anIOExceptionrather than failing later with aNullPointerExceptionorNumberFormatException.Behavioural impact:
duoutput is now deterministic (UTF-8).IOException: du produced no output for ...).ProcMapsnow reads/proc/*/mapswith explicit UTF-8 and NIO APIsProcMapsconstructor switched fromnew FileReader(...)toFiles.newBufferedReader(Paths.get(...), StandardCharsets.UTF_8).Behavioural impact:
/proc/.../mapsis now explicit and consistent.Mappingobjects are produced for valid lines and an invalid line will still fail fast.Thread-safe initialisation and switching of
PosixAPIproviderPosixAPIHoldernow:POSIX_APIasvolatile.loadPosixApi()anduseNoOpPosixApi()to ensure only one active provider instance is selected under concurrent access.Behavioural impact:
PosixAPI.posix()always returns a consistent singleton even under heavy multi-threaded startup.Clarified default behaviour for
mlockallPosixAPI.mlockall(int flags)default implementation remains a no-op for providers that do not supportmlockall, but is now explicitly documented as such and acknowledges the parameter to avoid warnings.Behavioural impact:
mlockallcalls instead of failing, and this is intentional.Minor JNR implementation refinements
JNRPosixAPI:get_nprocs_confincachedNprocsConf(same lazy caching semantics, clearer naming).mlock2_helper tomlock2Native(...)and continues to fall back to plainmlockon unsupported platforms or flags.fallocate64andposix_fallocatefallbacks; behaviour remains the same (fall back to plainfallocateor return-1on error).Behavioural impact:
Behavioural contract strengthened and covered by tests
New tests validate and lock in behaviour that was previously implicit:
NoOpPosixAPITestandNoOpConcurrencyTestverify that:NoOpPosixAPIreturn neutral values orfalseas per the documented contract.PosixRuntimeExceptionwith a consistent message rather than failing silently.lastError()always returns0, even under multi-threaded access.PosixAPIDefaultsTestverifies that:lseekandmmapenum overloads correctly delegate to the integer/bit-mask variants.mlock/mlockallimplementations behave as described (no-op, no exceptions).PosixAPIHolderTestchecks:useNoOpPosixApi()replaces the current provider with aNoOpPosixAPI.loadPosixApi()converge on a single provider instance.Behavioural impact:
Non-functional changes
Build and quality profiles
BOM update:
net.openhft:third-party-bombumped from3.27ea5to3.27ea7.New
qualityMaven profile:Adds
maven-checkstyle-plugin(3.6.0) configured with:chronicle-quality-rulesCheckstyle configuration.failOnViolation=true,logViolationsToConsole=true, andincludeTestSourceDirectory=true.Adds
spotbugs-maven-plugin(4.9.8.1) with:Max, threshold =Low,includeTests=true.chronicle-quality-rules.process-test-classeswith thecheckgoal, so SpotBugs findings gate the build.Usage:
mvn -P quality clean verifywill now run the stricter quality gates for this module.Impact:
-P qualitywill now fail on Checkstyle or SpotBugs issues, raising the non-functional bar for new changes.Architecture, requirements, security and system-properties documentation
New docs under
src/main/docs:architecture-overview.adoc– module architecture, role in Chronicle stack, provider selection and performance expectations.decision-log.adoc– Posix-specific decisions and a small set of sharedALL-*decisions, now aligned with the Nine-Box taxonomy.project-requirements.adoc– moved fromsrc/main/adoc/tosrc/main/docs/, slightly tightened wording and cross-references.security-review.adoc– threat model and secure coding considerations for Posix.New top-level docs:
systemProperties.adoc– documents Posix-relevant system properties (for examplemlockall.dump,jvm.isarm).TODO.md– module-local TODO, aligned with the globalARCH_TODO/ ISO-alignment work.README and licence header updates:
README.adoc/LICENSE.adocnow include standard AsciiDoc front-matter (:toc:,:lang: en-GB,:source-highlighter: rouge) and updated links to the newsrc/main/docslocations.Agent guidance and documentation style
AGENTS.mdextended to include Posix-specific guidance:src/main/docs.:sectnums:, use of::lists, British English, ISO-8859-1 only).Checkstyle-related clean-ups
Minor code style updates (comments, whitespace,
CHECKSTYLE:OFF/ONguards) across:ClockId,MMapProt,Mapping,PosixAPI, various JNR interfaces and tests.These are purely cosmetic and aimed at keeping the new
qualityprofile clean.Testing
New and existing unit tests have been added/updated to cover:
NoOpPosixAPITest,NoOpConcurrencyTest).PosixAPIHolderTest).PosixAPIDefaultsTest)./procparsing (MappingTest,ProcMapsTest,ProcMapsEdgeCaseTest).PosixRuntimeExceptionTest).JNRPosixAPITestminor improvements).