Prevent duplicate Feature Flagging runtimes - #12250
Draft
leoromanovsky wants to merge 2 commits into
Draft
Conversation
Claim process-wide ownership before starting configuration polling and event delivery so future standalone and injected modes cannot run concurrently.
Contributor
|
🎯 Code Coverage (details) 🔗 Commit SHA: 9a0f9fb | Docs | View more details | Give us feedback! |
Contributor
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
Attempt the atomic ownership transition before checking idempotency so the runtime claim behavior remains race-safe and fully covered.
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.
Motivation
Java Feature Flags is gaining two supported installation surfaces: a standalone dd-openfeature runtime and an agent-integrated runtime used by SSI. Without explicit process-wide ownership, both surfaces can start configuration polling and event delivery in the same JVM, producing duplicate requests and duplicate telemetry for customers who combine the library with the Java agent.
Changes
The Feature Flagging gateway now records which runtime owns configuration and event delivery. Claims are exclusive and idempotent for the current owner. The agent system claims ownership immediately before initialization and releases it during shutdown, while declining to start when the standalone runtime already owns the process.
The focused gateway and agent-system tests cover exclusive claims, idempotency, release behavior, and the agentless activation path when standalone ownership already exists.
Decisions
Ownership lives in the bootstrap gateway because it is the one process-wide object shared by the provider and agent integration. This PR intentionally does not add the standalone runtime yet; it establishes the invariant needed by the next PR in the stack. A runtime may retry its own claim, but a different runtime cannot replace the active owner.
Validation: ./gradlew :products:feature-flagging:feature-flagging-bootstrap:test :products:feature-flagging:feature-flagging-agent:test :products:feature-flagging:feature-flagging-bootstrap:spotlessCheck :products:feature-flagging:feature-flagging-agent:spotlessCheck