Skip to content

Commit 27ca0a2

Browse files
committed
refactor: remove OpenFeatureAPIFactory class
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
1 parent 4041ebc commit 27ca0a2

2 files changed

Lines changed: 19 additions & 56 deletions

File tree

src/main/java/dev/openfeature/sdk/OpenFeatureAPI.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,17 @@
1616
import lombok.extern.slf4j.Slf4j;
1717

1818
/**
19-
* A global singleton which holds base configuration for the OpenFeature
20-
* library.
21-
* Configuration here will be shared across all {@link Client}s.
19+
* Holds base configuration for the OpenFeature library.
20+
*
21+
* <p>Most applications should use the global singleton via {@link #getInstance()}; configuration
22+
* there is shared across all {@link Client}s. For dependency-injection frameworks, testing, or
23+
* multi-tenant scenarios that need fully independent state (providers, hooks, evaluation context,
24+
* event handlers, transaction context propagators), instantiate a new instance directly with
25+
* {@code new OpenFeatureAPI()}.
26+
*
27+
* @apiNote Isolated API instances (per spec section 1.8) are experimental and subject to change.
28+
* @see <a href="https://openfeature.dev/specification/sections/flag-evaluation#18-isolated-api-instances">
29+
* Spec &sect;1.8 &mdash; Isolated API Instances</a>
2230
*/
2331
@Slf4j
2432
@SuppressWarnings("PMD.UnusedLocalVariable")
@@ -40,6 +48,14 @@ public class OpenFeatureAPI implements EventBus<OpenFeatureAPI> {
4048
private final AtomicReference<EvaluationContext> evaluationContext = new AtomicReference<>();
4149
private TransactionContextPropagator transactionContextPropagator;
4250

51+
/**
52+
* Creates a new, independent {@link OpenFeatureAPI} instance with fully isolated state
53+
* (providers, hooks, evaluation context, event handlers, transaction context propagators).
54+
*
55+
* <p>For typical usage, prefer the global singleton via {@link #getInstance()}.
56+
*
57+
* @apiNote Isolated API instances (per spec section 1.8) are experimental and subject to change.
58+
*/
4359
public OpenFeatureAPI() {
4460
this(new AutoCloseableReentrantReadWriteLock());
4561
}

src/main/java/dev/openfeature/sdk/isolated/OpenFeatureAPIFactory.java

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)