Skip to content

Commit d4b668c

Browse files
fix: make openFeatureProvider an instance field instead of static
The static field caused all DevCycleLocalClient instances to share the same DevCycleProvider, which is incorrect when clients have different configurations. This aligns with DevCycleCloudClient's implementation.
1 parent 4510bde commit d4b668c

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/main/java/com/devcycle/sdk/server/local/api/DevCycleLocalClient.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -325,21 +325,17 @@ public void clearHooks() {
325325
this.evalHooksRunner.clearHooks();
326326
}
327327

328-
private static DevCycleProvider openFeatureProvider = null;
328+
private DevCycleProvider openFeatureProvider = null;
329329

330330
/**
331331
* @return the OpenFeature provider for this client.
332332
*/
333333
@Override
334334
public FeatureProvider getOpenFeatureProvider() {
335335
if (openFeatureProvider == null) {
336-
synchronized (DevCycleLocalClient.class) {
337-
if (openFeatureProvider == null) {
338-
openFeatureProvider = new DevCycleProvider(this);
339-
}
340-
PlatformData platformData = PlatformData.builder().sdkPlatform("java-of").build();
341-
localBucketing.setPlatformData(platformData.toString());
342-
}
336+
openFeatureProvider = new DevCycleProvider(this);
337+
PlatformData platformData = PlatformData.builder().sdkPlatform("java-of").build();
338+
localBucketing.setPlatformData(platformData.toString());
343339
}
344340
return openFeatureProvider;
345341
}

0 commit comments

Comments
 (0)