-
Notifications
You must be signed in to change notification settings - Fork 61
Clarify Chronicle Threads requirements/docs and tighten event loop, pauser, and disk-monitor behaviour #338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
peter-lawrey
wants to merge
13
commits into
develop
Choose a base branch
from
adv/develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…null checks, and refactoring variable declarations across multiple classes
james-mcsherry
approved these changes
Nov 25, 2025
…entLoop classes for cleaner code
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Functional changes
Agent and contributor guidance
Updated
AGENTS.mdto:iconv, IDE inspections).mvn -q clean verifyfrom a clean checkout) and when to open PRs.src/main/docs/decision-log.adocandsrc/main/docs/project-requirements.adoc.EventGroup / priorities / lifecycle
EventGroup:runsInsideCoreLoop()null-safe when no core loop is configured.TimeoutExceptionwith a richer message including rendered state of core and monitor loops plus a thread dump, rather than rethrowing the raw exception.EventGroupBuilder:Ensures the priority set passed to
withPrioritiesis copied into anEnumSet, avoiding external mutation.Documents and enforces that:
Event loops and pausers
AbstractLifecycleEventLoop:privateGroupasvolatileso group ownership changes are visible across threads.BlockingEventLoop:ExecutorService.executeinstead ofsubmitwhen starting handler runners and annotatesisRunningOnThreadloop to avoid SpotBugs false positives.MediumEventLoop:parentandserviceas final transient fields.MonitorEventLoop:executeinstead ofsubmitfor its internal executor.Threads.shutdownDaemonand centralises use ofEventLoop.DEBUG_ADDING_HANDLERS/DEBUG_REMOVING_HANDLERS.VanillaEventLoop:closeAllhelper which duplicated existingCloseable.closeQuietlybehaviour.Threads:forEachThreadnow null-checks threads obtained reflectively before dereferencing state, improving robustness on exotic executors.ThreadHolder/ monitor harness:ThreadHolder.isAlive()no longer throwsInvalidEventHandlerException, simplifying monitoring call sites.ThreadMonitorHarnessguards against negativeactionCallDelayto avoid spurious “monitor delayed” reports.ThreadsThreadHolder.monitorThreadDelayed()now uses a helper to format nanoseconds into milliseconds with tenths precision and logs a clearer message.Pauser behaviour and accounting
BusyPauser:pause(long, TimeUnit)now unconditionally throwsUnsupportedOperationException(instead of advertising aTimeoutExceptionit never throws), making the contract explicit and matching its stateless nature.LongPauser:pause()wraps the timed variant and ignores the timeout exception as “effectively infinite”.doPause(long delayNs):threadis cleared andpausingis reset in afinallyblock.MilliPauser:pause(long, TimeUnit)no longer declaresTimeoutExceptionand delegates todoPauseMS.doPauseMS(long)mirrors theLongPauserimprovements: snapshot of the current thread, safe park, elapsed time accounting, and clearing ofthreadandpausinginfinally.Disk space monitoring
DiskSpaceMonitor:Stores the threshold percentage in an
AtomicInteger, exposinggetThresholdPercentage()/setThresholdPercentage(int)with thread-safe updates.Uses
computeIfAbsentresult directly when initialisingDiskAttributes.Refines disk-full percentage calculation:
thresholdPercentageusing a rounded “X.Y% full” figure derived from a double fraction rather than integer division.Logs disk-space check durations via
Jvm.perf()with clearer millisecond formatting if a check takes more than 1 ms.Other core changes
Pauser.SleepyWarning.warnSleepy()is explicitly marked as empty (one-time warning work lives in static initialiser).EventLoopThreadHolderand related monitor classes add minor calculations/annotations to satisfy static analysis without changing semantics.System property semantics and behaviour
systemProperties.adoc:Jvm.getBooleaninterprets flags).Non-functional changes
Documentation, architecture and requirements
Root
README.adoc:Adds standard attributes (
:lang: en-GB,:source-highlighter: rouge).Introduces a “Links” section pointing to:
project-requirements.adoc,functional-requirements.adoc,architecture-overview.adoc,operational-controls.adoc,thread-safety-guide.adoc,thread-security-review.adoc,thread-performance-targets.adoc,decision-log.adoc, andsystemProperties.adoc.Adds an “Advanced Usage Example” showing how to split latency-sensitive and operational tasks across two
EventGroups.Requirements and decision docs:
Move the main spec from
src/main/adoctosrc/main/docsand split into:project-requirements.adoc(full functional and non-functional spec, updated to mention priority gating and the monitor-only case),functional-requirements.adoc(tabular summary of keyTHR-FN-*requirements and their verification),architecture-overview.adoc(full topology, trade-offs, configuration overview),operational-controls.adoc(renamed fromthread-operational-controls.adoc, with cross-links to the other docs),thread-safety-guide.adoc(renamed fromthread-thread-safety-guide.adoc, expanded cross-links),thread-performance-targets.adoc(now with highlighter and microsecond symbols),thread-security-review.adoc(expanded to include trust zone, ISO 27001 mapping, and dependency posture).Replace the old
src/main/adoc/decision-log.adocwith a newsrc/main/docs/decision-log.adoc:Documentation references in
project-requirements.adocupdated to point at the new filenames (architecture-overview.adoc,operational-controls.adoc,thread-safety-guide.adoc) and to clarify EventGroup behaviour when priority sets are empty.Build and dependency alignment
Root
pom.xml:net.openhft:third-party-bomfrom3.27ea5to3.27ea7, aligning Chronicle Threads with the latest BOM used across the enterprise stack.Test and usability improvements
Tests updated to reflect new behaviours and improve clarity:
ThreadsTestCommon.setMonitorInitialDelayMs(int)to avoid scattered static mutations.SystemTimeProvider.CLOCKis reset via a dedicated helper inThreadsTestCommonafter each test.DiskSpaceMonitorTestnow records exceptions after raising the threshold, making the test more reliable.EventGroupTest,EventGroupHandlerTest,EventLoopConcurrencyStressTest,LoopIntrospectionTest,MediumEventLoopTest,VanillaEventLoopTest, etc.) have improved assertions, more explicit comments, and cleaner use ofExecutorService.execute/ lambdas.PauserTest,PauserTimeoutTest) acknowledge theBusyPausercontract (timed pause unsupported) and reduce busy-spin in wait loops.EventLoopStateRendererTest,ThreadMonitorHarnessTest) have clearer assertions and helper methods to keep expectations readable.SingleAndMultiThreadedExample, JLBH benchmarks) are slightly refactored to use loops/arrays instead of repeated variables, improving readability without changing semantics.Miscellaneous non-functional cleanups:
@SuppressWarningsannotations and small refactors to keep static analysis (SpotBugs, Checkstyle, Sonar) clean while preserving behaviour.