chore: Allow for completion reporting for FDv2SourceResult consumption.#128
Merged
kinyoklion merged 3 commits intota/SDK-1633/test-data-source-synchronizerfrom Feb 4, 2026
Merged
Conversation
kinyoklion
commented
Feb 3, 2026
| private final Object queueLock = new Object(); | ||
| private final LinkedList<FDv2SourceResult> queue = new LinkedList<>(); | ||
| private final LinkedList<CompletableFuture<FDv2SourceResult>> pendingFutures = new LinkedList<>(); | ||
| private final IterableAsyncQueue<FDv2SourceResult> resultQueue = new IterableAsyncQueue<>(); |
Member
Author
There was a problem hiding this comment.
The behavior here ends up not really queuing, but it makes the implementation simple.
kinyoklion
commented
Feb 3, 2026
| future.complete(FDv2SourceResult.shutdown()); | ||
| } | ||
| return CompletableFuture.anyOf(shutdownFuture, future).thenApply(r -> (FDv2SourceResult) r); | ||
| if (!initialSent.getAndSet(true)) { |
Member
Author
There was a problem hiding this comment.
Removed the need for the lock, and this just needs to be basically a latch.
kinyoklion
commented
Feb 3, 2026
| private final LinkedList<CompletableFuture<FDv2SourceResult>> pendingFutures = new LinkedList<>(); | ||
| private final IterableAsyncQueue<FDv2SourceResult> resultQueue = new IterableAsyncQueue<>(); | ||
| private final CompletableFuture<FDv2SourceResult> shutdownFuture = new CompletableFuture<>(); | ||
| private volatile boolean closed; |
Member
Author
There was a problem hiding this comment.
I removed closed because I don't see a real need for it. It is a bit of an optimization, but this isn't very high frequency, so it seems nice to just be simple.
kinyoklion
commented
Feb 3, 2026
Member
Author
There was a problem hiding this comment.
Should be identical to the FDv1 tests, but using the FDv2 version.
Member
Author
|
bugbot review |
08f24e2 to
a26dc8c
Compare
lib/sdk/server/src/main/java/com/launchdarkly/sdk/server/integrations/TestDataV2.java
Show resolved
Hide resolved
tanderson-ld
approved these changes
Feb 4, 2026
4f26ccf
into
ta/SDK-1633/test-data-source-synchronizer
3 checks passed
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.
Note
Medium Risk
Touches core FDv2 data-source result consumption and introduces new callback/lifecycle semantics that could affect threading or resource cleanup if misused; behavior is covered with new integration tests but remains concurrency-sensitive.
Overview
Adds consumption completion reporting for FDv2 results by making
FDv2SourceResultCloseable, adding an optional completion callback pluswithCompletion(), and updatingFDv2DataSourceto use try-with-resources when handling initializer/synchronizer results so callbacks reliably fire.Refactors
TestDataV2to use this mechanism (wrapping results with per-synchronizer completions, switching its internal queueing toIterableAsyncQueue, and removing the old polling-basedawaitPropagationhelper), and addsTestDataV2WithClientTestto assert initialization, flag updates/deletes, rule/target behavior, status updates, and multi-client propagation.Written by Cursor Bugbot for commit 08f24e2. This will update automatically on new commits. Configure here.