Skip to content

refactor(concurrency): add bounded work queues and versioned signals - #6547

Merged
pgermosen merged 2 commits into
floci-io:mainfrom
AndreKurait:refactor/concurrency-primitives-20261025
Oct 25, 2026
Merged

pgermosen merged 2 commits into
floci-io:mainfrom
AndreKurait:refactor/concurrency-primitives-20261025

Conversation

@AndreKurait

@AndreKurait AndreKurait commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add two internal JDK coordination primitives for the separately retained service notification changes. KeyedWorkQueue bounds active workers and retained keys, coalesces duplicate notifications, prevents same-key overlap and returns dirty keys to the queue tail. VersionedSignal preserves notifications between an authoritative state read and waiting.

This foundation changes no service scheduling by itself. Callers retain responsibility for account/region identity, authoritative state, periodic recovery, cancellation and resource draining. Callbacks execute outside the admission monitor. The concurrency guide documents these contracts and is linked from MkDocs.

Type of change

  • Internal refactoring (refactor:) supporting bounded background work

Validation

10 focused Java 25 cases passed with zero failures, errors or skips across KeyedWorkQueueTest and VersionedSignalTest at tree 31a480c79650c11d46f2db0490d2597ea6411a72. Packaging and cached offline Checkstyle passed in that qualification; the online Checkstyle attempt was stopped after a remote metadata certificate failure.

Before publication on main 857d312a45419372327c116ea41ef4980abca518, all six feature files, the concurrency source/test directories and Checkstyle configuration were compared with that qualification and remain identical. The only POM delta is an unrelated test-scoped Global Accelerator SDK dependency using the existing SDK version. Docs, partition and diff gates passed again at tree afd1b6b599ddec9db7b6783bf431590e88ec9871. This is source-equivalence evidence, not another test execution.

No new dependency, endpoint, wire format, storage or configuration behavior is introduced. Dependent service runtime validation, benchmarks, AWS, Docker, native and full-suite qualification are outside this foundation's evidence.

Checklist

  • ./mvnw test passes locally (focused selection above passed; full suite not run)
  • Focused concurrency tests and caller contracts included
  • Commit messages follow Conventional Commits
  • Contribution limits respected: marked ready after a maintainer merge freed a ready slot

Before ready promotion, the complete patch replayed cleanly onto main 7c9c8ee3981326be4356634567a1681f23890561 as tree bab9320d2b6b5b45d10f77959f1456e8267e80ae. All six feature files, POM, test configuration, Maven configuration and Checkstyle files are identical to the qualified draft. Current Jackson PRs #6555 and #6481 have no changed-file overlap. No tests were repeated for this source-equivalent promotion.

Review follow-up: the stress test now awaits every producer future so task exceptions cannot hide a partial workload. Both concurrency classes passed again (10 cases, zero failures/errors/skips), with Checkstyle passing at tree 8ddeae8e96579571075880813aa5c10fdbbb9a28. Production sources are unchanged.

Introduce bounded keyed admission and versioned state notifications with deterministic concurrency tests and explicit caller ownership contracts.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
@hectorvent hectorvent added documentation Improvements or additions to documentation floci-core labels Oct 25, 2026
@AndreKurait
AndreKurait marked this pull request as ready for review October 25, 2026 20:54
@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; the previous finding is fixed and no new issues were found.

Summary

Adds bounded keyed work queues, versioned change signals, focused tests, and caller guidance.

  • Keyed background work stays bounded while repeat requests get another pass.
  • State-change waits keep notifications visible between a read and sleep.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Submit key] --> B{Closed?}
  B -->|Yes| R[Reject]
  B -->|No| C{Key already retained?}
  C -->|Yes| D[Mark dirty]
  C -->|No| E{Capacity available?}
  E -->|No| R
  E -->|Yes| F[Queue key]
  F --> G[Run when a worker is available]
  G --> H{Notified during work?}
  H -->|Yes| I[Return key to queue tail]
  I --> G
  H -->|No| J[Release key]
Loading

Reviews (2) · Last reviewed commit: "test(concurrency): surface producer task..." · Reviewed by Greptile

Await each submitted producer future before asserting queue convergence so producer exceptions cannot silently reduce the workload.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>

@pgermosen pgermosen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@AndreKurait thanks, this holds up. A key stays in pending while it runs, so no second worker picks it up, and a notification during the pass puts it back at the tail. VersionedSignal has the caller read the version before the state, so a signal in between isn't lost.

@pgermosen
pgermosen merged commit 615e12d into floci-io:main Oct 25, 2026
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation floci-core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants