[#3773]: phase 1 Make ClaimTask, SplitTask and MergeTask fully async#4530
Open
laura-devriendt-lemon wants to merge 1 commit intoenhancement/3773/replace-joinunwrap-pooled-processorfrom
Conversation
Removes all joinAndUnwrap calls from ClaimTask, SplitTask and MergeTask. Each task's internal logic is now a proper async chain — no coordinator threads are blocked waiting on token store operations. Key changes: - ClaimTask: two sequential UoW calls chained with thenCompose; fetchToken failure caught via exceptionally returning false (preserving original try/catch behavior) - SplitTask: splitAndRelease(Segment) changed from boolean to CompletableFuture<Boolean>; callers updated from thenApply to thenCompose to avoid unwaited nested futures; try/finally replaced with whenComplete to guarantee deadline cleanup on both success and failure - MergeTask: two sequential segment fetches chained with thenCompose; thenCombine(...).thenCompose(f -> f) keeps parallel token fetching while flattening the nested future; mergeSegments now returns CompletableFuture<Boolean> with whenComplete for deadline cleanup Adds ClaimTaskTest covering all four scenarios: segment already active, segment not in available list, successful claim, and failed claim (returns false as normal completion, not exceptional). Extends MergeTaskTest with a missing branch: merge initiated from the higher-ID segment, verifying the lower-ID segment token is always placed first in MergedTrackingToken regardless of which segment triggered the merge. Refs #3773
|
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
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.



Removes all joinAndUnwrap calls from ClaimTask, SplitTask and MergeTask. Each task's internal logic is now a proper async chain — no coordinator threads are blocked waiting on token store operations.
Key changes:
Adds ClaimTaskTest covering all four scenarios: segment already active, segment not in available list, successful claim, and failed claim (returns false as normal completion, not exceptional).
Extends MergeTaskTest with a missing branch: merge initiated from the higher-ID segment, verifying the lower-ID segment token is always placed first in MergedTrackingToken regardless of which segment triggered the merge.